Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

If IE 6 , I want to produce warning and free download other browser icons

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?

like image 626
thinzar Avatar asked Aug 16 '09 07:08

thinzar


3 Answers

You can get some examples that don't require server side scripting from ie6nomore.com.

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.

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.

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";
}
like image 173
Thorarin Avatar answered Oct 18 '22 22:10

Thorarin


Use IE conditional comments in your page

<!--[if lt IE 7]>
include a warning here (in an iframe, perhaps, to save extra bandwidth)
<![endif]-->
like image 28
Steve Gilham Avatar answered Oct 18 '22 21:10

Steve Gilham


There exits a simple jQuery plugin for this it's called IE Alert. Check it out on: http://nmsdvid.com/iealert/

like image 21
nmsdvid Avatar answered Oct 18 '22 21:10

nmsdvid