您好我想检测浏览器,IE 8或更多将适合我.为此,我使用了以下代码,但IE11失败了.对于其他正确的检测.
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;
}
Run Code Online (Sandbox Code Playgroud)
以下是我尝试但无法成功的链接.
javascript asp.net internet-explorer browser-detection internet-explorer-11