views:

345

answers:

2

Hello,

My question is the folowing

Is there a solid javascript code to detect if a browser is IE(I don't care about others)

I found some script, but it generates an undefined error in FF.

I edited my question because I found some regex serverside solution for this on this forum It's enough for now.

thanks, Richard

+1  A: 

Use the

navigator

object

navigator.appName

will give the browser name and

navigator.appVersion

will give the browser version.

Another one is listed here

Browser detect

rahul
thank you, that was actually thew first script I found. I edited my question
Richard
+1  A: 

You can find here very useful technique for IE detection using conditional tags.

<!DOCTYPE your favorite doc type> 
     <html> 
       <head>...</head>  
       <body>  
          <!--[if IE]>  
                  <div id="IEroot">  
          <![endif]-->  
                   <p id="IE">This browser is IE.</p>  
                   <p id="notIE">This browser is not IE.</p>  
          <!--[if IE]>  
                  </div>  
          <![endif]-->  
      </body> 
    </html>

You can use it and put script tag between it to define Javascript action only for IE.

Artem Barger