62
rated 0 times
[
69]
[
7]
/ answers: 1 / hits: 29228
/ 13 Years ago, mon, august 8, 2011, 12:00:00
I have a javascript code to redirect mobile phone users. Could you check the code, I've picked it up from the net, total newb and I'd value your input regarding the quality of the script...
Does it cover all types of mobile phones?
function RedirectSmartphone(url) {
if (url && url.length > 0 && IsSmartphone())
window.location = url;
}
function IsSmartphone() {
if (DetectUagent(android)) return true;
else if (DetectUagent(iphone)) return true;
else if (DetectUagent(ipod)) return true;
else if (DetectUagent(symbian)) return true;
return false;
}
function DetectUagent(name) {
var uagent = navigator.userAgent.toLowerCase();
if (uagent.search(name) > -1)
return true;
else
return false;
}
RedirectSmartphone(http://mobile.version.com);
More From » jquery