Anyone know a good Javascript Prompt for the User to upgrade their browser
I am trying to find a good way开发者_开发技巧 to notify visitors to our site to upgrade from IE6 to get full functionality. I see lots of this in use. Anyone know a good source for it?
You could put an conditional comment in for ie6. Or you could do it by checking the user agent string.
<!--[if IE 6]>
Special instructions for IE 6 here
<![endif]-->
Using this answer on SO :
Detecting IE6 using jQuery.support
You can check and if yes show your prompt
Chrome Frame is my preferred approach to this particular problem, because if they have IE6, there's a good chance they're being forced by an IT department at their company.
http://www.chromium.org/developers/how-tos/chrome-frame-getting-started
All you need this in the head:
<meta http-equiv="X-UA-Compatible" content="chrome=1">
<!--[if IE 6]>
<script type="text/javascript" src="http://ajax.googleapis.com/ajax/libs/chrome-frame/1/CFInstall.min.js"></script>
<![endif]-->
And this before end </body>
(for jQuery):
$(document).ready(function() {
CFInstall.check({
mode: "overlay",
destination: "http://{{ host }}"
});
});
If you're not using jQuery or another library just include the call directly:
CFInstall.check({
mode: "overlay",
destination: "http://{{ host }}"
});
There's a few methods specific to IE6, you can get started here then style them whatever way you want...but those are the basic triggers that only IE6 will run.
I'd be amiss if I didn't recommend you read this SO question/answer set (10k+ only) on the same topic, a lot of excellent points you need to consider.
精彩评论