Session/Cookie problems on some mobile phones
by Stii
You’re busy developing a mobile site and have a log in section, but for the life of you you simply cannot log in. You dig deeper and find that for some daft reason that the mobile device you’re using (like the Nokia 6110 Navigator) does not store the session cookie, thus your session is lost every time you load a page.
You would probably run into this if your domain name is something like http://afrigator.mobi, without the www. or m. (i.e. without a domain prefix). The issue is that cookies for a specific domain are specified like:
//Cookie domain $domain = '.afrigator.mobi';
A phone like the Nokia 6110 Navigator (its the phone I use, but there may well be lots more) is looking for the domain prefix (the www. or m.) and fails to store the cookie if none is present like in the case of http://afrigator.mobi
A pain in the butt which you might want to be aware of! The solution? Add a prefix should work. Downloading and installing Opera Mini could also work (although, I’m speculating since I have not tried that, but will soon enough). Anyone know of any other solution?
Some phones in fact don’t even support cookies at all :(
For MobilePress we use PHP sessions to store data (we don’t use a login system though). Obviously the session data resides on the server and only lasts as long as that users time on the website.
Thanx Matt. Yeah, PHP sessions works fine in that case, but if the session needs to be persistent it is a bit of an issue :(
MobilePress is fantastic BTW! I use it right here FYI ;-)
if a browser doesn’t support cookies php has the option to propagate session id’s directly into URLs. Its ugly and vulnerable to session hijacking but it would work
perhaps you would consider it as a temp measure
session.use_only_cookies = Off
session.use_trans_sid = On
Slacker, eish, I don’t really like that, but I suppose it is an option. Thanx!