I want my site to block access to visitors that are using outdated browsers such as IE6 and IE7 etc.

I am looking for a script that I can use to block certain browsers accessing my site

  • 1
    May I ask why do you want to block them?!
    – Omne
    Sep 19, 2012 at 14:35
  • 1
    The only real reason for not supporting (different from "blocking") older browsers is that your web project not only makes use of, but requires the latest and most advanced browser to function. Is that your scenario? If so, what scripting environment are you using?
    – msanford
    Sep 19, 2012 at 15:23
  • 2
    I'm blocking them because I can't be bothered supporting them. It might even be technically feasible to support even IE6 but as I'm a solo developer have to choose new features vs legacy browser support and chose the first. Only site access stats can tell me I'm wrong :)
    – Lorenzo
    Sep 19, 2012 at 15:41
  • 1
    Hmm... but don't do that! IMO start with a simple design which supports older browsers too, then expand it for new technologies. believe me, you'll loose a lot with blocking older browsers, there are many people who still use them, people who never upgrade their default IE... if youo're website is live atm, your stats should confirm this. even websites created solely for new browsers have some level of support for older ones...
    – Omne
    Sep 19, 2012 at 15:48
  • 2
    "better practices" and "blocking access to legacy browsers" - isn't that a contradiction?!
    – MrWhite
    Sep 19, 2012 at 21:17

1 Answer 1


You can detect older versions of Internet Explorer using the IE Conditional Comments feature. The following snippet when included in a web page will redirect versions older than IE 8 to a separate page -

<!--[if lt IE 8]>
<SCRIPT LANGUAGE="javascript">

You can also choose to hide the page's content by setting the container tag's display property style to none via JavaScript.

The browser can also be detected through server-side code.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.