I don't know anything about javascript, not programming, but I wanted to create a page that checked the os user, and if they use a mobile OS (iphone, android, etc.), forward them to the mobile site, and if they use computer, send them to a regular website. Here is the page I made:
<head>
<title>OS Check | website.web.org</title>
<SCRIPT LANGUAGE = "javaScript">
if (navigator.appVersion.indexOf("Win")!=-1) && (navigator.appVersion.indexOf("Mac")!=-1) && (navigator.appVersion.indexOf("X11")!=-1) && (navigator.appVersion.indexOf("Linux")!=-1) location.href= "http://website.web.org/mobile/index.html"
else location.href = "http://website.web.org/Home.html"
</SCRIPT>
</head>
Basically, what he should do is check all the major computer OSs, and if it’s not one of them, send the user to a mobile web page, but if this is one of them, send them to the computer site.
Can someone please tell me what the error / problem is on this page / script?
Thanks Luke
source
share