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 derfloh 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
Joined
Mar 18, 2001
Messages
10
Location
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!
 
see thread215-152604

Hope this helps,
Erik <!-- My sport: Boomerang throwing !!
This year I will participate at the World Championships in Germany. (!! Many Happy Returns !! -->
 
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 == &quot;Netscape&quot; && browserVer >= 4 || browserName ==
&quot;Microsoft Internet Explorer&quot; && browserVer >= 4)
version = &quot;1&quot;;
else if (browserName == &quot;Netscape&quot; && browserVer >= 3)
version = &quot;2&quot;;
else
version = &quot;3&quot;;
if (version == &quot;1&quot;) {
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