最新消息:雨落星辰是一个专注网站SEO优化、网站SEO诊断、搜索引擎研究、网络营销推广、网站策划运营及站长类的自媒体原创博客

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

programmeradmin1浏览0评论

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/

发布评论

评论列表(0)

  1. 暂无评论