HTML5

Turn On HTML5 In IE8 or Lower

HTML5

HTML5 is becoming more and more popular, with this has some issues. If you want to support some of the older browsers which are still being used such as IE8 and lower then using HTML5 you are going to have some trouble.

Internet Explorer 8 And Lower

The problem with IE8 and lower browsers is that they were created years ago before any of the new HTML5 tags were invented so it can't support them. Microsoft will not release updates for these browsers because they have created IE9 so they want people to upgrade to this.

If people don't upgrade then they are stuck with an out of date browser which can't support these new HTML tags.

The browsers won't know anything about these new tags of article, section, hav, header, footer so it can't support them. If you are using these tags you are most likely be styling the tag itself or you would have to add a class to the tag, which takes away the point of using HTML5.

As the browser doesn't know about these tags then it can't style them so you will find that in IE8 or lower your websites will be without many styles.

Correct Way To use HTML5 For IE

To get IE to know about these tags you need to add some Javascript to create the elements, which is done by using the following snippet.

<script>
  document.createElement('header');
  document.createElement('section');
  document.createElement('article');
  document.createElement('aside');
  document.createElement('nav');
  document.createElement('footer');
</script>

But this is not a good way of working as you will have to remember to include this at the top of every page of your website and then if you want to add a new HTML5 element you have to go back to every page to add this in.

What you need is a Javascript file to include which will create these elements.

Remy Sharp has created a Javascript file which he hosts at google code that will do this for you.

Copy the following at the top of your pages and it will include this code file on your website if the visitor is using an IE browser lower than version 9.

<!--[if lt IE 9]>
<script src="http://html5shim.googlecode.com/svn/trunk/html5.js"></script>
<![endif]-->
Back to top ^

Join Paulund

  • Get access to 100s of premium tutorials and downloadable content
  • Members content consists of Premium WordPress plugins, CSS packages, jQuery packages, tutorial demo files and templates for 100s of web development tutorials
  • In-depth development tutorials
  • Priority tutorial requests
  • Priority email development support
  • No ads

Here at Paulund you'll find Web Development tutorials and snippets focusing mainly on PHP, WordPress and CSS. Members will get access to premium tutorials that go into more detail about development with these languages. You will also get access to downloadable premium content based on the tutorial.

Join Paulund

Leave a Reply

Your email address will not be published. Required fields are marked *