Recently one of the team member got the issue with IE 11 while writing the code to detect the browser.The browser detection code what he has written is not working with IE 11 . The issue here is Microsoft keep updating the User Agent String every time when new IE version released ..
To fix the issue i made few changes and now it is working .
Here is the code to detect the browser including IE 11
<script type="text/javascript" >function GetBrowserDetails() {var ua = window.navigator.userAgentvar msie = ua.indexOf("MSIE ")// If Internet Explorer, return version numberif (msie > 0)return parseInt(ua.substring(msie + 5, ua.indexOf(".", msie)))// If Internet Explorer 11 handling differently becaue UserAgent string updated by Microsoftelse if (!!navigator.userAgent.match(/Trident\/7\./))return 11;else//If another browser just returning 0return 0}if (GetBrowserDetails() > 0)alert("Hey This is Internet Explorer and the version no is " + GetBrowserDetails());elsealert("Hey This is not IE browser");</script>
No comments:
Post a Comment