Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations gkittelson on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Detecting browser type

Status
Not open for further replies.

drumin

Technical User
Mar 18, 2001
10
GB
I'm looking to develop a piece of script which will determine the browser type of the user. Once this has been determined the user will be directed to the respective page.

Users with Mac/Netscape/IE 5 and under will go to one page

Users with IE 5.01 and over will go to another.

This needs to be seemless.

Any help appreciated!

Thanks!
 
I came across this script online it works and maybe you can use it also:
Code:
browserName = navigator.appName;
browserVer = parseInt(navigator.appVersion);
if (browserName == "Netscape" && browserVer >= 4 || browserName ==
"Microsoft Internet Explorer" && browserVer >= 4)
version = "1";
else if (browserName == "Netscape" && browserVer >= 3)
version = "2";
else
version = "3";
if (version == "1") {
var correctwidth=1024
var correctheight=768
if (screen.width<correctwidth||screen.height<correctheight)
location=&quot;PAGE_FOR_LOW_SIZE.htm&quot;
else
location=&quot;PAGE_FOR_HIGH_SIZE.htm&quot;
}
if (version == &quot;2&quot;) {
var toolkit = java.awt.Toolkit.getDefaultToolkit();
var screen_size = toolkit.getScreenSize();
var correctwidth=800
var correctheight=600
if (screen_size.width<correctwidth||screen_size.height<correctheight)
location=&quot;PAGE_FOR_LOW_SIZE.htm&quot;
else
location=&quot;PAGE_FOR_HIGH_SIZE.htm&quot;
}
if (version == &quot;3&quot;)
location=&quot;DEFAULT_PAGE.htm&quot;
</SCRIPT>
I have not failed; I merely found 100,000 different ways of not succeding...
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top