Posted By

djmicahelb on 04/11/10


Tagged


Versions (?)

Who likes this?

2 people have marked this snippet as a favorite

r4ge
wbednarski


Conditional Comments for Javascript


 / Published in: JavaScript
 

Use this to filter out Ie or other browsers using Javascript

  1. <script type="text/javascript">
  2. /*@cc_on
  3.  
  4.   @if (@_jscript_version == 9)
  5.   document.write("You are using IE9");
  6.  
  7.   @elif (@_jscript_version == 5.8)
  8.   document.write("You are using IE8");
  9.  
  10.   @elif (@_jscript_version == 5.7 && window.XMLHttpRequest)
  11.   document.write("You are using IE7");
  12.  
  13.   @elif (@_jscript_version == 5.6 || (@_jscript_version == 5.7 && !window.XMLHttpRequest))
  14.   document.write("You are using IE6");
  15.  
  16.   @elif (@_jscript_version == 5.5)
  17.   document.write("You are using IE5.5");
  18.  
  19.   @else
  20.   document.write("You are using IE5 or older");
  21.  
  22.   @end
  23.  
  24. @*/
  25. </script>

Report this snippet  

You need to login to post a comment.