Unfortunately , it redirects Opera too! Here's the code:
if ((browserName=="Netscape" && browserVer>=3))
window.location = "www.google.com"
Can anybody help me?
Any user can cause any browser to send any string in the navigator.appName.
Opera is the easiest to set, and early versions sent an IE string by default, if IE was already installed.
You can use object detection to identify IE, but browser support changes constantly, so you have to keep up with any changes.
navigator.isIE= !!(!window.addEventListener && window.attachEvent);
if(navigator.isIE)// do IE only code
else// do non IE
Checking the useragent means you redirect anyone who has the useragent set to that value and since IE and Firefox allow the useragent to be set to anything and other browsers allow it to at least be set to the IE or Firefox default value you can't use useragent to distinguish between browsers.
The following code will run in IE only as all other browsers see it as a comment.
window.location = "www.google.com";
Thank you for your replies!
Felgall , it works like a charm Thak you very much!!