| |||||||
This is a discussion on Check Operating System and Redirect within the HTML/CSS/JavaScript section, part of the Programming category; The code below checks for current OS and redirects accordingly to specific URL.. Code: <script language="JavaScript"> // This script sets ...
![]() |
|
| | LinkBack | Thread Tools | Display Modes |
|
#1
| ||||
| ||||
|
The code below checks for current OS and redirects accordingly to specific URL.. Code: <script language="JavaScript">
// This script sets OSName variable as follows:
// "Windows" for all versions of Windows
// "MacOS" for all versions of Macintosh OS
// "Linux" for all versions of Linux
// "UNIX" for all other UNIX flavors
// "Unknown OS" indicates failure to detect the OS
if (navigator.appVersion.indexOf("Win")!=-1) window.location=("http://tech6.com");
if (navigator.appVersion.indexOf("Mac")!=-1) window.location=("http://tech6.com");
if (navigator.appVersion.indexOf("X11")!=-1) window.location=("http://tech6.com");
if (navigator.appVersion.indexOf("Linux")!=-1) window.location=("http://tech6.com");
</script>
__________________ Would you like to Link To Us | Support TECH6 by going Premium Know more about me at Vinayaks.com | Follow TECH6 at Twitter |
|
#2
| ||||
| ||||
|
What would this be used for?
__________________ My iPhone is better than yours........... I Am Back! |
|
#3
| ||||
| ||||
|
nice question !! its too useful for me atleast.. I am currently using this script in the homepage of my mobile website (WAP). The concept is like that if somebody tries to open my WAP website from PC (i.e. from OS like Windows, Linux etc.), he gets redirected to homepage of my site. BUT if he opens it from Nokia Symbian OS, he can view the site.. isn't that cool :001_cool:
__________________ Would you like to Link To Us | Support TECH6 by going Premium Know more about me at Vinayaks.com | Follow TECH6 at Twitter |
![]() |
| Bookmarks |
| Thread Tools | |
| Display Modes | |
| |