html - Display javascript alert with Internet Explorer conditional comment - Stack Overflow

The design of my website is pretty ugly with versions of Internet Explorer smaller than 7.I'd lik

The design of my website is pretty ugly with versions of Internet Explorer smaller than 7. I'd like to display a javascript alert for the users whose browser is concerned.

Something like : "The design of the website is not optimized for your browser. Please upgrade ... "

The thing is that javascript code inside conditional ments doesn't work so how can I do this ?

The design of my website is pretty ugly with versions of Internet Explorer smaller than 7. I'd like to display a javascript alert for the users whose browser is concerned.

Something like : "The design of the website is not optimized for your browser. Please upgrade ... "

The thing is that javascript code inside conditional ments doesn't work so how can I do this ?

Share Improve this question asked Sep 12, 2011 at 10:05 BrunoBruno 9,10713 gold badges40 silver badges55 bronze badges 1
  • Have a look at: browserupgrade.info/tools – Felix Kling Commented Sep 12, 2011 at 10:07
Add a ment  | 

4 Answers 4

Reset to default 3

Works fine for me:

<!--[if IE 6]>
<script>alert("IE 6");</script>
<![endif]-->

http://jsfiddle/W9gPQ/1/

I wouldn't do this if I were you, though. An alert() is terribly obtrusive. Why not just show a div.

The alert will work fine, in the sites where javascriptting is allowed. The following code part will be used to show an alert

<script>
alert("Your Message");
</script>

Refer to alert for more details.

Here´s some great info about Conditional ments; http://www.quirksmode/css/cond.html

...and perhaps this IE 6 block script can inspire you; http://css-tricks./955-ie-6-blocker-script/

Good luck! :)

Just made a jQuery plugin to solve these kind of problems. Check it out on: http://nmsdvid./iealert/

发布者:admin,转转请注明出处:http://www.yc00.com/questions/1745207927a4616681.html

相关推荐

发表回复

评论列表(0条)

  • 暂无评论

联系我们

400-800-8888

在线咨询: QQ交谈

邮件:admin@example.com

工作时间:周一至周五,9:30-18:30,节假日休息

关注微信