开发者

How to detect IE6, and show alert?

I'm trying to show an alert when a user using IE6 uses my site. I'm thinkin开发者_开发技巧g something like this will work:

<!--[if IE 6]>
<script language="Javascript">
alert ("The year 2004 just called - they want their browser back!")
</script>
<![endif]-->

I'd test this but I don't have a Windows box I can use ATM. Is this the correct way to do it?


Yes, that works:

How to detect IE6, and show alert?

Of course, you could use something like this, which is a bit more friendly.


This has already been answered but I really wanted to post something I did for this. My personal website, have configured a similar script:

  <!--[if lt IE 9]>
  <script type="text/javascript">
    location.replace("/ie/?next=/");
  </script>
  <![endif]-->

So whenever anyone with IE vesion less then 9, the browser redirects to this page.


This way to detect Internet Explorer version

<!--[if IE 6]>
<p>Welcome to any incremental version of Internet Explorer 6!</p>
<![endif]-->


OR 

<!--[if gte IE 6]>
<SCRIPT LANGUAGE="Javascript">
alert("Congratulations! You are running Internet Explorer 6 or greater.");
</SCRIPT>
<P>Thank you for closing the message box.</P>
<![endif]-->

More detail you can refer link as here http://msdn.microsoft.com/en-us/library/ms537512.aspx

  • Thanks Abhi.


Yes the code you posted should totally work. Maybe just add a semicolon at the end of the line.

And one more interesting way:

http://www.ie6nomore.com/


Perhaps this may be of some use to you.


#lowCssSupportNotice {
    display: none !important;
    display: block; /* IE6 sees this */
    position: absolute;
    left: 50%;
    top: 50%;
    width: 300px;
    height: 300px;
    margin: -150px 0 0 -150px;
}
0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜