/ Published in: JavaScript

Returns the version of Windows Internet Explorer or a -1 (indicating the use of another browser).
Expand |
Embed | Plain Text
Copy this code and paste it in your HTML
// Returns the version of Windows Internet Explorer or a -1 // (indicating the use of another browser). function getInternetExplorerVersion() { var rv = -1; // Return value assumes failure. if (navigator.appName == 'Microsoft Internet Explorer') { var ua = navigator.userAgent; var re = new RegExp("MSIE ([0-9]{1,}[\.0-9]{0,})"); if (re.exec(ua) != null) rv = parseFloat( RegExp.$1 ); } return rv; }
URL: http://www.mkyong.com/javascript/how-to-detect-ie-version-using-javascript/
Comments
