Hi! just wanted to thank this conversation as I have rad it thru and implemented all steps successfully (thanks to Johnnyb). Now my main website diverts to mobile pages when opened on a phone. However, it just occurred to me, that I have in my mobile home page an option to go back to Classic view. That will never be achieved, as Classic view automatically diverts back to mobile. Is there any script that implements re-direction once only?
Thanks in advance !! Ella
If you ever decide to use server-side mobile detection (phones or tablets), I’ll point you to http://mobiledetect.net (someone else pointed to this script above, but it was the old Google Code repository). It’s MIT licensed and updated weekly. I’m one of the maintainers. Just look at the examples, it’s simple.
Since everyone asks for both both “detection” and “redirect” or ways to choose and remember the website layout, I’ll suggest using the example: https://github.com/serbanghita/Mobile-Detect/blob/devel/examples/example1.php , it’s a simple procedural example, also includes an example of footer links for the visitor to choose the type of layout.
> Say you want to hide a sidebar with 6 ads in it for the mobile version, if using media-queries then that sidebar and those ads are still loaded in the page, they are just hidden using display: none. If each of those ads is 10k then that’s 60k (+ the weight of the HTML) which isn’t needed.
I’ve gotten a bit confused. I have a similar problem. I built a site for someone, pretablets and smart phones. I’d have to re-build the whole site to use css media queries, I’d have to build a new responsive site. I built a totally separate jQuery mobile site, not a variation on original theme. I need a way to redirect small screens to this site, all new html and css etc., when the user device is a smart phone. Can anyone please help. I use jQuery regularly and have a basic knowledge of php. Much thanks in advance.
How can I manage to redirect a mobile user if clicked on a link “go to desktop version” to be directed to a desktop version? Currently with your script the device still detects that the user is using mobile and redirects again to the mobile version, but loads it funnily.