Posts Tagged ‘browser’

RIP IE6 – How to block Internet Explorer 6 from displaying web pages

As I stated in a previous post, Internet Explorer 6 is the nightmare of every web developer. It’s slow, it’s insecure and it’s stupid. Unfortunately, the fact that it’s more than 10 years old is not stopping some users from using it. Resolving the compatibility issues that usually arise sometimes is unworthy, so here is a little tweak to block the users using IE6 (or lower!):

In the <head> of the html file, include:

<!–[if lte IE 6]>
<script type=”text/javascript” src=”./js/rip_ie6.js”></script>
<![endif]–>
The content of the Javascript file is quite simple:

$(window).load(function() {
$(‘body’).css(“background-color”,”#414141″);

var message = ‘Sorry, but your browser (Internet Explorer 6) is not suported by this site. Please update to a newer version, or try an alternative browser:’;

var links = ‘<br><br><a href=”www.mozilla.com” title=”Mozilla Firefox”>Mozilla Firefox</a>’;
links += ‘<br><br><a href=”www.google.com/chrome” title=”Google Chrome”>Google Chrome</a>’;

$(‘body’).html(‘<div style=”width:600px;height:254px;background:white;margin:200px auto;padding: 20px;”><img src=”js/rip_ie6.png” alt=”" style=”float:left;margin-right:20px;”>’+message+links+’</div>’);

});

As you can see, I offer the user the possibility to download Firefox or Chrome, trying to minimize the damage suffered.
Of course, your web-page needs to have jQuery installed for the above code.

Test every Internet Explorer with meta tag

There’s only one thing that makes the life of a web-developer a Hell, and it’s the cross-browser compatibility. And the biggest problems, of course, are with Internet Explorers. We are so lucky there are at least 4 versions of it in which our application/site should work at this time. Installing every one of the versions on the same station is not possible, and the softwares from the market are not always 100%. So, if you want to test your work in the major IE versions, you can use the following code:

<meta http-equiv=”X-UA-Compatible” content=”IE=IEVersion” />

I used it from Internet Explorer 8, and placed the code right after the <body> tag.