如果浏览器是IE6则隐藏特定的DIV
我的网站上有一个 DIV,它调用一些外部 javascript...不幸的是,供应商不支持 IE6。该脚本位于全局页脚中,因此它位于每个页面上。
我收到错误消息,我们的 https 网站正在传递不安全的内容,您想查看该内容吗...等等等等...
如果浏览器是 IE6,是否可以隐藏此 div?
<div id="get-satisfaction">
<style>
a#fdbk_tab {
top:60px;
}
</style>
<script type="text/javascript" charset="utf-8">
//content here
</script>
</div>
I have a DIV on my site that calls a few external javascripts... unfortunatley the vendor does not support IE6. This script is in the global footer, so its on every page.
I get the error that our https site is passing content that is not secure, would you like to view the content...blah blah...
Is is possible to just hide this div if the browser is IE6??
<div id="get-satisfaction">
<style>
a#fdbk_tab {
top:60px;
}
</style>
<script type="text/javascript" charset="utf-8">
//content here
</script>
</div>
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(5)
更好的选择是检测浏览器服务器端,如果是 IE6,则不渲染 javascript 标签。
A better option is to detect the browser server side and not render the javascript tag if it's IE6.
这应该可以解决问题:
http://davidwalsh.name/ie-conditional-comments
This should do the trick:
http://davidwalsh.name/ie-conditional-comments
在开始 DIV 标签之前添加以下代码:
在结束 DIV 标签之后添加以下代码:
所以,如果浏览器是 IE6,它应该隐藏您的 div。
Add the following code before the opening DIV tag:
Add the following code after the closing DIV tag:
so,if the browser is IE6 ,it should hide your div.
此代码段向每个比 IE6 更新的浏览器显示内容。已确认可以工作。
请参阅:在 IE6 中隐藏一些 HTML?
This snippet shows the content to every browser that is newer than IE6. It's confirmed to work.
See: Hiding some HTML from IE6?
取自此处: http://en.wikipedia.org/wiki/Conditional_comment#Downlevel-revealed_conditional_comment
Taken from here: http://en.wikipedia.org/wiki/Conditional_comment#Downlevel-revealed_conditional_comment