Overview
This is quite a simple JavaScript function which checks if the current browser is Internet Explorer (IE). If yes it will return the version number. Although this function is limited up to version 10, as Edge isn't seen as Internet Explorer.
JavaScript Code:
<script type="text/javascript" language="javascript"> //CALLING THE FUNCTION if(msieversion() <= 10){ //DO SOMETHING HERE alert(msieversion()); } //BEGIN CHECK THE IE VERSION function msieversion() { var ua = window.navigator.userAgent; var msie = ua.indexOf("MSIE "); // If Internet Explorer, return version number if (msie > 0){ return parseInt (ua.substring (msie+5, ua.indexOf (".", msie ))); } } //END CHECK THE IE VERSION </script>