Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Prevent viewing page using Internet Explorer

I have developed a site that looks great in modern browsers like Chrome, Safari, Firefox and Opera, however, it looks terrible in older versions of Internet Explorer.

Is there some code that I can use that will prevent the page from loading if it detects an older version of IE?
Perhaps the code could load a different page?

Any ideas on how to best accomplish this? Thanks.

like image 279
DanielAttard Avatar asked Jan 25 '12 22:01

DanielAttard


1 Answers

Yeah for sure, you can use a client side re-direct, or a server-side redirect. OR You can just display different content based off the browser.

Javascript/jQuery:

if ($.browser.msie && parseInt($.browser.version, 10) < 9) {
    // Do IE specific Tasks
    // window.location = "http://somewhat.com"
}else{
   //Do other tasks
}

PHP:

<?php
$browser = get_browser(null, true);
print_r($browser);
?>
like image 100
Eric Hodonsky Avatar answered Oct 22 '22 13:10

Eric Hodonsky