Point them to Mobile site - how?
Posted: Mon Feb 04, 2013 9:57 am
Hi
I am after a bit of advice.
We have a web site that uses a PHP preg_match script to determine if they are on iphone, blackberry or android (yes I know there are others). And if they are, it redirects them straight to the mobile version.
However, we want to give them the option to "go to Normal site" should they want to, since many phones now show the normal site just as well - and often it has more features anyway.
I did this would work with the extra bit on the end - so they'd go to the mobile site, and click to use normal site. That would then store a $cookie saying "normalbrowser" for example, and as such that cookie is no longer NULL, and it keeps them on the normal site.
But this won't work, because it's an "||" or statement. So what's the best way to do this?
I am after a bit of advice.
We have a web site that uses a PHP preg_match script to determine if they are on iphone, blackberry or android (yes I know there are others). And if they are, it redirects them straight to the mobile version.
However, we want to give them the option to "go to Normal site" should they want to, since many phones now show the normal site just as well - and often it has more features anyway.
Code: Select all
if ((preg_match("/(iPhone|BlackBerry|Android)/", $_SERVER["HTTP_USER_AGENT"]) || ($cookiedevice == NULL))
{ ... }But this won't work, because it's an "||" or statement. So what's the best way to do this?