Posted By

satie83 on 03/31/12


Tagged

javascript ie internet explorer


Versions (?)

Javascript - Obtain explorer version


 / Published in: JavaScript
 

URL: http://www.mkyong.com/javascript/how-to-detect-ie-version-using-javascript/

Returns the version of Windows Internet Explorer or a -1 (indicating the use of another browser).

  1. // Returns the version of Windows Internet Explorer or a -1
  2. // (indicating the use of another browser).
  3. function getInternetExplorerVersion()
  4. {
  5. var rv = -1; // Return value assumes failure.
  6.  
  7. if (navigator.appName == 'Microsoft Internet Explorer')
  8. {
  9. var ua = navigator.userAgent;
  10. var re = new RegExp("MSIE ([0-9]{1,}[\.0-9]{0,})");
  11. if (re.exec(ua) != null)
  12. rv = parseFloat( RegExp.$1 );
  13. }
  14.  
  15. return rv;
  16. }

Report this snippet  

You need to login to post a comment.