如果IE 6,我想生成警告和免费下载其他浏览器图标 [英] If IE 6 , I want to produce warning and free download other browser icons
问题描述
我的网站想要打开IE7及以上。如果IE 6,我想生成警告和免费下载其他浏览器图标。是否可能?
My web site want to be open IE7 and above .If IE 6 ,I want to produce warning and free download other browser icons .Is it possible?
推荐答案
您可以从 ie6nomore.com 。
他们使用IE的条件注释功能,如下所示:
They use the conditional comments feature of IE, like this:
<!--[if lt IE 7]>
Your browser is outdated!
<![endif]-->
但是网站上的例子实际上提供了到其他浏览器的链接。当然,你可以滚动自己的版本更适合你的布局。
But the examples on the site actually offer links to other browsers. Of course, you can roll your own version that suits your layout better.
当然,你可以做这个服务器端如果你喜欢,因为你使用PHP 。这里使用 $ _ SERVER [HTTP_USER_AGENT]
的其他示例应该让你开始。使用 get_browser
可能是过度的,因为它需要一个相当大的数据文件才能起作用。
Of course, you can do this server side if you prefer, since you're using PHP anyway. The other examples here using $_SERVER["HTTP_USER_AGENT"]
should get you started. Using get_browser
may be overkill, as it requires a fairly large data file to function.
感兴趣的是检测旧的IE版本服务器端,这应该做:
If you're only interested in detecting old IE versions server side, this should do:
preg_match('/; MSIE (\d+.\d+)/', $_SERVER['HTTP_USER_AGENT'], $matches);
if (count($matches) > 1 && $matches[1] <= 6.0)
{
echo "Your browser is outdated";
}
这篇关于如果IE 6,我想生成警告和免费下载其他浏览器图标的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!