Javascript browser recognition + redirect. Help!

Hello ,

I have a javascript that recognises the browser and then redirects to a page. However , I want only IE explorer to be redirected. I mean , if browser is IE then redirect to a page.
Unfortunately , it redirects Opera too! Here’s the code:

    <SCRIPT language="JavaScript">
    var browserName=navigator.appName;
    var browserVer=parseInt(navigator.appVersion);
    if ((browserName=="Netscape" && browserVer>=3))

    if (version=="n3")
      window.location = ""

Can anybody help me? :frowning:

bump help please :x

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.

<script type=“javascript”>
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.

You can distinguish Internet Explorer from other browsers because it runs JScript instead of JavaScript and so recognises JScript conditional comments.

The following code will run in IE only as all other browsers see it as a comment.

   @if (@_jscript)
      window.location = "";
@end @*/

Thank you for your replies!

Felgall , it works like a charm :smiley: Thak you very much!!