I don’t often do technical posts but I spent so much time trying to find a solution to this one that I had to put it up for others.
The Problem: Several Samsung and Cricket devices (predominantly in the US) seem to have problems accepting cookies from mobile web sites.
Affected devices: After much research I discovered that this is something specific to the OpenWave browser. The models this includes are Samsung: SGH 350, SCH-R430, SCH-R210; LGE: MT375/1.0, LG290C; Motorola: MOT-V3am and many more.
Cause and effect: The OpenWave browser cannot accept cookies properly from a domain name that does not have a subdomain. It will try set a cookie from http://yourdomain.com as http://.yourdomain.com and obviously this will fail.
Solution: Look for “UP.Browser” in the user-agent string and redirect these users to a domain that has a subdomain and set the cookie there. Here is a PHP code sample:
//Check if the user has the OpenWave browser
$pos = strpos($_SERVER['HTTP_USER_AGENT'],”UP.Browser”);
//If so, make sure the user is not already on the correct domain and then do the redirect
if($_SERVER['HTTP_HOST']!= “m.yourdomain.mobi” && $pos) {
//Add the redirect code here
}
You may not want to redirect in this case, you may want to do something else but the bottom line is that you can’t set a cookie and if you need one you’re going to have to do it this way.
