We Recommend

Pro JavaScript Techniques Pro JavaScript Techniques
Pro JavaScript Techniques is the ultimate JavaScript book for the modern web developer. It provides everything you need to know about modern JavaScript, and shows what JavaScript can do for your web sites. This book doesn't waste any time looking at things you already know, like basic syntax and structures.


Posted By

localhorst on 02/29/08


Tagged

detection ie7 browserdetection


Versions (?)


Who likes this?

3 people have marked this snippet as a favorite

adix
wbowers
SpinZ


detect IE7 with JavaScript


Published in: JavaScript 


URL: http://blog.t8d.de/2007/01/09/ie7-und-javascript-sicher-erkennen/

  1. <script type=”text/javascript”>
  2. if (window.XMLHttpRequest) {
  3. //IE 7, mozilla, safari, opera 9
  4. } else {
  5. // IE6, older browsers
  6. }
  7. </script>
  8.  
  9. <script type=”text/javascript”>
  10. if (typeof document.body.style.maxHeight != “undefined”) {
  11. // IE 7, mozilla, safari, opera 9
  12. }
  13. else {
  14. // IE6, older browsers
  15. }
  16. </script>
  17.  
  18. <script type=”text/javascript”>
  19. isIE7 = false;
  20. /* @cc_on
  21. @if (@_jscript_version &;gt;= 5.7)
  22. isIE7 = true;
  23. @end
  24. @*/
  25. </script>
  26.  
  27. <script type=”text/javascript”>
  28. if((document.all)&&(navigator.appVersion.indexOf(”MSIE 7.”)!=-1)){
  29. document.write(”IE 7);
  30. }
  31. </script>

Report this snippet 

You need to login to post a comment.