Skip to Content

TheBlogReaders.com

Salesforce.com, PHP, MySQL, Javascript, Ajax, Htacces

How to detect my running Internet Explorer Browser using Javascript?

Be First!
by July 15, 2014 JAVASCRIPT

How to detect my running Internet Explorer Browser using Javascript?

We can easily detect the running user browser versions like the user is running IE6 (or earlier) or IE7 (or later) using javascript and see the following code for your reference:


Browser Details

<script type="text/javascript">// < !&#91;CDATA&#91;
// < !&#91;CDATA&#91;
	function getInternetExplorerVersion() {

	  var rv = -1; // Return value assumes failure.
	  if (navigator.appName == 'Microsoft Internet Explorer') {
		var ua = navigator.userAgent;
		var re  = new RegExp("MSIE (&#91;0-9&#93;{1,}&#91;\.0-9&#93;{0,})");
		if (re.exec(ua) != null)
		  rv = parseFloat( RegExp.$1 );
	  }
	  return rv;
	}

	function checkVersion() {
	  var msg = "You're not using Internet Explorer.";
	  var version = getInternetExplorerVersion();

	  if ( version > -1 ) {
		if ( version >= 6.0 ) {
		  msg = "You're using a latest Internet Explorer."
		} else {
		  msg = "You should upgrade your Internet Explorer.";
		}
	  }
	  alert(msg);
	}

	checkVersion();

// ]]></script>

For Reference:

http://msdn.microsoft.com/en-us/library/ms537509.aspx

(725)

Previous
Next

Leave a Reply