Here’s a snippet of code that can detect what version of Internet Explorer a user is using to browse your page. If the version number is below what you specified you can easily tell them to update, redirect them somewhere or just tell them to get lost. The code is very simple:
1 2 3 4 5 6 7 8 | // Set $badver to the IE version (and below) that you want to detect $badver = 6; $statement = 'MSIE ([0-'.$badver.']\.[0-'.$badver.'])'; ereg($statement,$_SERVER['HTTP_USER_AGENT'],$reg); if(isset($reg[1])) { // If browser version is $badver or below echo 'Version ' . $badver . ' or below!'; } |
If you want to use this, just copy and paste the above code into the top of your page. This code is based on Karol Krizka’s function found here.
Kort på svenska. Använd koden ovan för att avgöra om användaren använder en gammal version av Internet explorer. Kan vara gött att skicka IE6-användare dit pepparn växer.