好的,我是新手,所以请多多包涵。我的网站是为 Internet Explorer 9 和 Safari、Chrome 和 Mozilla Firefox 设置的。但是,当我使用 Internet Explorer 7 在我的计算机上加载我的网站时,它会显示此条件 div
,但它仍会加载其下方的内容。有没有办法阻止它加载内容?
这是我的来源:
<!--[if lte IE 8]>
<div style=' clear: both; text-align:center; position: relative;'>
<a href="http://windows.microsoft.com/en-US/internet-explorer/downloads/ie-9/worldwide-languages"><img src="/protected-wp-content/images/internet-explorer-9-update.png" border="0" alt="" /></a>
</div>
<![endif]-->
<!--[if IE 9]>
<script type="text/javascript" src="js/html5.js"></script>
<link rel="stylesheet" href="css/ie.css" type="text/css" media="screen">
<![endif]-->
最佳答案
那么,看来您想要 IE 8,而在用户下只能看到更新链接?!?!
撇开这是否是个好主意,这里是如何做到的:
<!--[if lte IE 8]>
<div style=" clear: both; text-align:center; position: relative;">
<a href="http://windows.microsoft.com/en-US/internet-explorer/downloads/ie-9/worldwide-languages">
<img src="/protected-wp-content/images/internet-explorer-9-update.png" border="0" alt="" />
</a>
</div>
<script type="text/javascript">
document.execCommand("Stop", true, null);
</script>
<![endif]-->
execCommand("Stop")
停止 IE 中的页面加载。 (在其他浏览器中不能始终如一地工作,但这在这里不是问题。;)
关于php - 条件 CSS 停止加载内容,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/6968917/