How to prevent website from being used on Internet Explorer

Hey, guys! With the lack of support for many important features in modern web design, such as flexbox, interactions, and other issues involving text wrap and dropdowns, I figure it’s just time to burn Internet Explorer!

Here’s the solution I’ve settled on (with some notes taken from this forum):

First, create a landing page that you want users to land on if they are on Internet Explorer. For my purposes I just created Internet Explorer, a simple page with links to recommended browsers, nothing fancy.

Next, paste the following code at the top of your global site header to ensure that it runs before anything else:

<!-- For IE <= 9 -->
<!--[if IE]>
<script type="text/javascript">
      if (window.location != "https://www.dynamic-structures.com/browser") {
        window.location = "https://www.dynamic-structures.com/browser";
        }
</script>
<![endif]-->

<!-- For IE > 9 -->
<script type="text/javascript">
    if (window.navigator.msPointerEnabled) {
      if (window.location != "https://www.dynamic-structures.com/browser") {
        window.location = "https://www.dynamic-structures.com/browser";
    }
  }
</script>

Be sure to insert the landing page URL you created everywhere it says “Insert landing page URL here”, but be sure to keep the quotation marks.

I hope this helps someone out, and if anyone has any suggestions for improving this, I’d love to see what you guys have!

Best,
Zach

2 Likes

Thank you very much!

I’d bet there are tons of people that would love this resource, thank you for sharing! :+1:

1 Like

This is great! Thank you for sharing.

1 Like