title: How to detect IE8 and display a page or alert
body: <p>I've got a website which was built using Jekyll. It doesn't render correctly in IE 8, therefore, I want a way to detect if they are using IE 8 and display an appropriate page / alert.</p>
  
  <p>I've got a function which detects the browser and replaces the page displayed:</p>
  
  <pre><code>"use strict";
  define([], function () {
      function ieVersion() {
          var myNav = navigator.userAgent.toLowerCase();
          return (myNav.indexOf('msie') != -1) ? parseInt(myNav.split('msie')[1]) : -1;
      }
      var v = ieVersion();
      if (ieVersion() &gt; -1) {
          document.location.replace("ie8.html");
      }
  });
  </code></pre>
  
  <p>I am calling it within the HEAD tag:</p>
  
  <pre><code>&lt;!DOCTYPE html&gt;
  &lt;html class='no-js' lang='en'&gt;
      &lt;head&gt;
        &lt;meta charset="utf-8"&gt;
        &lt;meta http-equiv="X-UA-Compatible" content="IE=edge,chrome=1"&gt;
        &lt;title&gt;{{ page.title }}&lt;/title&gt;
        &lt;meta content='width=device-width, initial-scale=1.0' name='viewport'&gt;
        &lt;link href='http://fonts.googleapis.com/css?family=PT+Sans:400,700,400italic,700italic|Droid+Serif:400,700,400italic,700italic' rel='stylesheet' type='text/css'&gt;
        &lt;link href='{{ site.url }}/css/framework.css' rel='stylesheet'&gt;
        &lt;link href='{{ site.url }}/css/syntax.css' rel='stylesheet'&gt;
        &lt;link href='{{ site.url }}/css/style.css' rel='stylesheet'&gt;
        &lt;link href='{{ site.url }}/css/fontello.css' rel='stylesheet'&gt;
  
        &lt;script src="https://ajax.googleapis.com/ajax/libs/jquery/1.8.3/jquery.min.js"&gt;&lt;/script&gt;
        &lt;script src="http://code.jquery.com/ui/1.9.2/jquery-ui.js"&gt;&lt;/script&gt;
        &lt;script src='{{ site.url }}/js/IE.js'&gt;&lt;/script&gt;
        &lt;script src='{{ site.url }}/js/modernizr.js'&gt;&lt;/script&gt;
  
      &lt;/head&gt;
  </code></pre>
  
  <p>However, it doesnt appear to work. </p>
  
  <p>I opened it within IE8 and there is a error saying:</p>
  
  <pre><code>'$' is undefined 
  IE.js
  </code></pre>