-3

我有一个与旧版本 Internet Explorer 不兼容的网站。我不想破坏非 IE 用户的体验,我想在 IE 用户输入我的网址时将他们重定向到同一站点的另一个兼容版本。这可能吗?

4

3 回答 3

3

是的,您可以使用IE 的条件注释来为旧版本的 IE 执行此操作。例如:

<!--[if lt IE 8]>
<meta http-equiv="refresh" content="0;url=/your/other/page" />
<![endif]-->

IE10 不再支持它们,但是,您可能也不需要使用 IE10 进行重定向。

于 2013-02-25T09:59:41.150 回答
1

有一个评论功能可以做到这一点。

<!--[if lte IE 7]>
  Redirect your page here.
<![endif]-->

对于重定向本身,您可以使用 javascript 或元标头:

使用 JavaScript:

<script>window.location = "http://www.my-new-page.com/"</script>

随着元

<meta HTTP-EQUIV="REFRESH" content="0; url=http://www.my-new-page.com/">
于 2013-02-25T10:07:16.083 回答
1

这篇文章

navigator.sayswho= (function(){
    var N= navigator.appName, ua= navigator.userAgent, tem;
    var M= ua.match(/(opera|chrome|safari|firefox|msie)\/?\s*(\.?\d+(\.\d+)*)/i);
    if(M && (tem= ua.match(/version\/([\.\d]+)/i))!= null) M[2]= tem[1];
    M= M? [M[1], M[2]]: [N, navigator.appVersion, '-?'];
    return M;

})(); navigator.sayswho[0] 是(字符串)版本

您所要做的就是:

var browser = navigator.sayswho[0];
if(browser == "MSIE") {
    document.location.href = "you.new.url.html";
}
于 2013-02-25T10:17:43.273 回答