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

Written by 

I am Sakthivel Madesh, a certified Salesforce Advanced Developer & Administrator working on Salesforce Technology since 2011. I am currently working in Techforce Services as Sr. Salesforce Developer. I have worked on multiple technologies Like PHP, Java, Salesforce, I am very passionate about Salesforce and to earn 15x Salesforce Certification. I love Trailhead for learning Salesforce Skill and Become a Trailhead 5x Ranger too. I Love to Learn & Share my Salesforce knowledge to Salesforce Learners/Beginner using My Blog and Salesforce Community.

Leave a Reply

Your email address will not be published. Required fields are marked *

*