Posted on March 7th, 2011 by Ian Devlin
Making HTML5 work in old versions of Internet Explorer

One of the main reasons why developers may not be making the move to HTML5 as yet is the perceived lack of support for legacy browsers. This is actually untrue, and whilst there might be some jiggery pokery required for proper backwards compatibility, it’s still possible.
Of course, by legacy browsers I mean Internet Explorer, as all the other major players update regularly and their users tend to follow suit: browsers such as Firefox, Safari and Opera have supported HTML5 for a while. Some developers may decide to stop supporting IE6, but for some that’s not an option and, at any rate, neither IE7 nor IE8 support HTML5 either. IE9 will, but it runs on Windows Vista and Windows 7 only, so the other versions will still be around for a long time to come, as we have seen with IE6.
So what needs to be done to get HTML5 working in Internet Explorer?
Unknown elements
Well first and foremost, IE won’t render any elements it doesn’t recognise, so it will completely ignore HTML5 structural elements such as header, footer, article, section, and nav, all major parts of a HTML5 site. This can be rectified by telling IE about these elements using JavaScript. The best way to do this is to include the HTML5 shiv script, created by Remy Sharp. This handy script creates all the relevant HTML5 elements which IE will now know about when rendering the page.
One problem with this is that it won’t work for users who have JavaScript turned off. Unfortunately there is no way around this, so a decision has to be made by the developer to either use HTML5 or stay with HTML 4.01.
Styling
Most browsers have internal stylesheets that, amongst other things, apply display:block to block level elements. Whilst some of the newer browsers now do this for the relevant HTML5 elements, some don’t, and this needs to be added for all browsers. Simply adding the following styling will do the trick:
article, aside, figure, footer, header, hgroup,
menu, nav, section { display:block; }
Form elements
And what about some of the new elements themselves, such as the new input types - how do these render on legacy browsers?
Fine actually. Since the HTML5 spec was extended in a backwards-compatible way, any input types that aren’t recognised, are simply treated as text and will simple be rendered as so.
Multimedia
As I’ve discussed in the past, the video and audio elements are designed to allow a fall back to Flash, which will work fine on Internet Explorer.
The move to HTML5 will still be a gradual one, and some won’t see nor have the need to use any of the new functionality that it provides, but when they do, they can be (relatively) safe in the knowledge that older browsers will render their sites just fine.
Tags: browser compatibility, html5, Internet Explorer, legacy browsers
Posted in: Real World Computing
Follow any responses to this entry through the RSS 2.0 feed.
You can skip to the end and leave a response. Pinging is currently not allowed.
8 Responses to “ Making HTML5 work in old versions of Internet Explorer ”
Leave a Reply
Authors
- Barry Collins
- Chris Brennan
- Christine Horton
- Darien Graham-Smith
- Dave Stevenson
- Davey Winder
- David Bayon
- David Fearon
- Ewen Rankin
- Ian Devlin
- Jon Honeyball
- Jonathan Bray
- Kevin Partner
- Mike Jennings
- Nicole Kobie
- Sasha Muller
- Steve Cassidy
- Stewart Mitchell
- Stuart Turton
- Tim Danton
- Tom Arah
Categories
- About the bloggers
- Android App of the Week
- CES 2013
- cloud computing
- From Gmail to Hotmail
- Green
- Hardware
- How To
- iPhone App of the Week
- Just in
- Microsoft Office 2010
- MWC 2013
- Newsdesk
- Online business
- Random
- Rant
- Real World Computing
- Software
- View from the Labs
- Web
- Windows 7
- Windows 8
Archives
- May 2013
- April 2013
- March 2013
- February 2013
- January 2013
- December 2012
- November 2012
- October 2012
- September 2012
- August 2012
- July 2012
- June 2012
- May 2012
- April 2012
- March 2012
- February 2012
- January 2012
- December 2011
- November 2011
- October 2011
- September 2011
- August 2011
- July 2011
- June 2011
- May 2011
- April 2011
- March 2011
- February 2011
- January 2011
- December 2010
- November 2010
- October 2010
- September 2010
- August 2010
- July 2010
- June 2010
- May 2010
- April 2010
- March 2010
- February 2010
- January 2010
- December 2009
- November 2009
- October 2009
- September 2009
- August 2009
- July 2009
- June 2009
- May 2009
- April 2009
- March 2009
- February 2009
- January 2009
- December 2008
- November 2008
- October 2008
- September 2008
- August 2008
- July 2008
- June 2008
- May 2008
- April 2008
advertisement


March 7th, 2011 at 11:32 am
I think a lot of developers are scared to start utilising HTML5’s awesomeness because you have to rely on JavaScript being turned on for IE to recognise certain new elements.
Though HTML5 is more than just new elements and people can use the doctype straight away, I think the HTML5 shiv scares a lot of people away, which is a great shame.
March 10th, 2011 at 3:47 pm
Did you mean HTML5 shim? A shiv is a knife ( http://en.wikipedia.org/wiki/Shiv_(weapon) ) whereas a shim is a way of fitting things together ( en.wikipedia.org/wiki/Shim ). Or maybe IE really has hacked you off!
March 10th, 2011 at 3:52 pm
Both! There’s a shiv (http://code.google.com/p/html5shiv/) and a shim (http://code.google.com/p/html5shim/).
March 16th, 2011 at 6:58 am
i used html5 and script for this but code still showing problem in ie7
March 23rd, 2011 at 11:38 am
So do you think I should be doing HTML5 now? I’m still XHTMLing. I like what HTML5 has to offer, but older browser support does put me off. The javascript disabled issue doesn’t bother me otherly. The majority of users don’t turn it off.
I’m currently in the process of doing a small refresh on my own site and was wondering how far down the HTML5 path I should go.
November 8th, 2011 at 6:32 am
Hi, you can use below modernizr by simple refering the javascript generated http://www.modernizr.com/.
Thanks
Yatharth (yatharth@gmail.com)
May 4th, 2012 at 6:57 pm
I’ve been playing around with HTML5 and like what I’ve seen. I reformatted a Website I run for a group, and, as usually, the people who are religious about not upgrading their browsers (or who work for companies that are still running IE8) are complaining the most. While I’ve been formatting sites for XHTML for years, I think I will shift over to HTML5 over the next few months.
May 7th, 2012 at 8:32 am
Hi Laurie,
What are the IE8 users complaining about? As the article shows and hints at, in most cases you can provide fallbacks for older IEs to work fine.