As it currently stands, this question is not a good fit for our Q&A format. We expect answers to be supported by facts, references, or expertise, but this question will likely solicit debate, arguments, polling, or extended discussion. If you feel that this question can be improved and possibly reopened, visit the help center作为指导。
                            
                        
                    
                
                6年前关闭。
            
        

如果有人使用任何版本的Internet Explorer访问该页面,我希望显示一条警报消息。我读过的所有帖子都说要使用,但似乎对我不起作用。

这是我的代码:

 <head>
 <script src="http://ajax.googleapis.com/ajax/libs/jquery/1.9.0/jquery.min.js"></script>
 .
 .
 .
  <!--[if IE]>
  <script>
    $(document).ready(function(){
        alert('This website is not compatible with internet explorer.
        Please visit the page with any other browser.');
    });
  </script>
  <![endif]-->
 </head>


难道我做错了什么?

最佳答案

如果您确实想为使用Internet Explorer版本5至9的所有Internet Explorer用户运行它,那么您的代码就可以了。这些是唯一支持条件注释的版本。

here是另一种解决方案,也是我在该站点上最喜欢的答案之一。它已经在Internet Explorer第六到第十版中进行了测试,它将查找Internet Explorer特定的功能,如果该功能存在,它将执行脚本。

10-05 20:46
查看更多