internet Explorer Versiyon Control


/ Published in: JavaScript
Save to your folder(s)

// adding ie version class on html tag


Copy this code and paste it in your HTML
  1. //IE VERSION CONTROL
  2.  
  3. function getInternetExplorerVersion() {
  4. var rv = -1; // Return value assumes failure.
  5. if (navigator.appName == 'Microsoft Internet Explorer') {
  6. var ua = navigator.userAgent;
  7. var re = new RegExp("MSIE ([0-9]{1,}[\.0-9]{0,})");
  8. if (re.exec(ua) != null) rv = parseFloat(RegExp.$1);
  9. }
  10. return rv;
  11. }
  12.  
  13. function checkVersion() {
  14. var msg = "Internet Explorer";
  15. var ver = getInternetExplorerVersion();
  16.  
  17. if (ver > -1) {
  18. $("html").addClass("ie").addClass("ie" + ver); //add version Class
  19. /*
  20. if ( ver >= 10.0 )
  21. msg = "NEW browser."
  22. else
  23. msg = "Old browser.";*/
  24. }
  25. }
  26. checkVersion();

Report this snippet


Comments

RSS Icon Subscribe to comments

You need to login to post a comment.