Return to Snippet

Revision: 56509
at March 31, 2012 20:35 by satie83


Initial Code
// 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;
}

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

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

Initial Title
Javascript - Obtain explorer version

Initial Tags
javascript, ie

Initial Language
JavaScript