php - 条件 CSS 停止加载内容

标签 php html css conditional-statements

好的,我是新手,所以请多多包涵。我的网站是为 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/

相关文章:

jquery - 当 child 有特定类(class)时如何将类(class)添加到 li

jquery - 如何为 Canvas 中的点添加工具提示?

javascript - 当用户开始滚动页面时隐藏链接

html - 如何在网页文章之间缩进/添加空格?网页格式

php - 如何扩展一个表中的逗号分隔字段并将其复制到使用相同唯一 ID 的第二个表中的多个字段

php - 在表单中搜索字段,然后对所有选定的结果执行某些操作

javascript - Javascript 中的 CSS 内联器(premailer)

html - 使用 Bootstrap 将 Div 定位在容器内

php - 用户 'admin' @'localhost' 的 MySQL 访问被拒绝(使用密码 : YES)

php - 如何通过一次提交将多行插入数据库