【发布时间】:2010-04-01 16:44:09
【问题描述】:
我使用 HTML 5 编写了一个应用程序,当有人从 IE 访问时,我不想显示错误框而不是页面。当它检测到navigator.appName 为Microsoft Internet Explorer 时,它会隐藏所有内容并显示开始隐藏的错误 div。 div如下:
<div id='ieerror' style='display:none;width:500px;height:500px;border:3px solid #ff0000;position:absolute;top:50%;left:50%;margin-top:-250px;margin-left:-250px;'>
<center>
<h1 style='font-size: 30px;'>Internet Explorer is not supported by Aud!</h1><br /><br />
<p>Internet Explorer does not support HTML 5 and therefore this application cannot run.<br />
Please upgrade your browser. We suggest <a href='http://www.google.com/chrome'>Google Chrome</a>!</p>
</center>
</div>
问题是当我在IE中访问页面时,会弹出带有边框的div,但它没有内容。里面什么都没有。我去view->source看了看,代码还在,但是没有渲染。我该如何解决这个问题?
【问题讨论】:
-
这是 ASP .net/php 吗?如果是这样,您可以使用请求中的标头来确定浏览器,如果是 IE,则只需发送错误页面。
-
另外,根据下面的评论,PO 提到这个问题发生在 IE8 中。不确定这是否适用于其他版本的 IE。