您好我想检测浏览器,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
我想知道如何检测我的网站用户是否使用Internet Explorer 11或更低版本的Javascript.
它应该兼容并适用于所有这些版本.
怎么实现呢?
对Web开发很新,请耐心等待.
我想检查浏览器使用的是IE(所有版本).
如果检测到IE,我需要更改CSS.
请指出正确的方向.
如何禁用我的图像边界线以及Internet Explorer 10中标记中的图像?我试过了:
a {
outline : none;
text-decoration: none;
}
a img {
border : 0;
outline : none;
}
img {
border : 0;
border-style: none;
}
Run Code Online (Sandbox Code Playgroud)
还有这个:
<meta http-equiv="x-ua-compatible" content="IE=edge" />
Run Code Online (Sandbox Code Playgroud)
还有这个:
<meta http-equiv="X-UA-Compatible" content="IE=EmulateIE9">
Run Code Online (Sandbox Code Playgroud)
什么都行不通.我的想法已经不多了.有人能帮帮我吗?
编辑:这是我的HTML和CSS文件:
<!doctype html>
<html>
<head>
<meta charset="utf-8" />
<title> Title </title>
<link rel="stylesheet" href ="main.css" />
<link rel="stylesheet" href ="menu.css" />
</head>
<body>
<div class = "page " align ="center">
<div class="header">
<img id="bannerimg">
<img id="menubar">
</div>
<div class="menu">
<table id="menubtns" …Run Code Online (Sandbox Code Playgroud) 我想检查当前域是否启用了IE11兼容性视图。可以通过以下方式设置兼容性视图:工具>兼容性视图设置。
我知道几年前就已经提出过这个问题,但是由于IE11的最新更新,答案似乎不再起作用。
有谁知道替代方法吗?
我尝试使用以下脚本
[if IE]
<script type="text/javascript">
window.location = "error.html";
</script>
[endif]
Run Code Online (Sandbox Code Playgroud)
除了其他浏览器(例如Chrome)也重定向到error.html页面之外,它的工作方式就像对待。怎么了 谢谢
我有疑问.
我必须将IE用户重定向到其他网站,从IE6到IE9这个代码工作得非常好.
Run Code Online (Sandbox Code Playgroud)<!--[if IE]><script type="text/javascript">window.location = "google.com";</script><![endif]-->
这段代码对IE 10非常有用
Run Code Online (Sandbox Code Playgroud)<script type="text/javascript">if (navigator.appName == 'Microsoft Internet Explorer'){self.location = "google.com"}</script>
但是我找不到IE11的任何解决方案 - 在这个浏览器中我的网站没有重定向.
我真的在寻找更多时间这个解决方案,但我找不到任何想法.
也许您知道如何只编写一个脚本来将所有IE浏览器重定向到其他网站?
非常感谢!