9

I'm trying to show an alert when a user using IE6 uses my site. I'm thinking 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?

MusiGenesis
  • 74,184
  • 40
  • 190
  • 334
sudo rm -rf
  • 29,408
  • 19
  • 102
  • 161

6 Answers6

10

Yes, that works:

alt text

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

thirtydot
  • 224,678
  • 48
  • 389
  • 349
4

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.

crodjer
  • 13,384
  • 9
  • 38
  • 52
2

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.
Abhishek B.
  • 5,112
  • 14
  • 51
  • 90
0

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/

CodeVirtuoso
  • 6,318
  • 12
  • 46
  • 62
-1

Perhaps this may be of some use to you.

void-pointer
  • 14,247
  • 11
  • 43
  • 61
  • Thanks for your comment, but I did state in my answer: *"but I don't have a Windows box I can use ATM"*. So yes, it wouldn't help me. :) – sudo rm -rf Jan 20 '11 at 04:57
  • I didn't give you the downvote, but you got it because it's not useful to the question asker: `I don't have a Windows box`. That extension is `---- WINDOWS ONLY ----`, and even if he did have Windows, it's very unlikely he'd have IE6 installed. – thirtydot Jan 20 '11 at 04:57
  • Sorry about that, I saw this earlier and I thought that this was a cross-platform solution. I should have read more carefully... – void-pointer Jan 20 '11 at 05:00
  • 1
    No problem buddy. :) I didn't down-vote either, not sure who did. – sudo rm -rf Jan 20 '11 at 05:03
-1
#lowCssSupportNotice {
    display: none !important;
    display: block; /* IE6 sees this */
    position: absolute;
    left: 50%;
    top: 50%;
    width: 300px;
    height: 300px;
    margin: -150px 0 0 -150px;
}
reisio
  • 3,242
  • 1
  • 23
  • 17
  • `!important` is evil from a usability point of view. Pretty icky to use that when there's more elegant options, like the conditional comment, that will most certainly not influence other browsers. – GolezTrol Jan 29 '11 at 21:26
  • 1
    I'm not sure you understand what usability is. IE conditional comments are proprietary, non-standard code — I'd hardly call them elegant. This will only influence IE6 and other (arguably) irrelevant browsers with incredibly poor CSS support, and is 100% valid, standardized code. – reisio Jan 30 '11 at 04:22