I checked related posts on this topic and it seems that the solutions are not quite what I am looking for because of the type of device detection code that I am using on my desktop site.
I have a desktop website at mydomain.com and have installed the following script to redirect mobile users to the mobile website at m.mydomain.com
function detect() {
var uagent = navigator.userAgent.toLowerCase();
var mobile = false;
var search_strings = [
"iphone”,
"ipod”,
"ipad”,
"series60”,
"symbian”,
"android”,
"windows ce”,
"windows7phone”,
"w7p”,
"blackberry”,
"palm”
];
for (i in search_strings) {
if (uagent.search(search_strings[i]) > -1)
mobile = true;
}
return mobile;
}
if (detect()) window.location = "http://m.mydomain.com/“;
The redirect works fine when someone uses http://mydomain.com from a mobile phone and the mobile version is displayed. However now I want to give the option to that mobile phone user to redirect to the full desktop website at domain.com without looping back to the mobile version.
How do I do that without using PHP? Is this possible using Jquery/Javascript? The typical won't work of course.
Thanks in advance..