Printing HTML5 in Internet Explorer with IE Print Protector

HTML5 is the proposed next standard for HTML 4.01, XHTML 1.0 and DOM Level 2 HTML and is estimated that HTML5 will reach W3C Recommendation by late 2010. Since the new HTML5 has got many new elements and attributes which reflects the usage on modern web sites, here IECSS has come up with the solution to print HTML5 pages with a proper format by using their new IE Print Protector.

Printing HTML5 in Internet Explorer with IE Print Protector
Printing HTML5 in Internet Explorer with IE Print Protector

IE Print Protector, a piece of JavaScript that allows us to print HTML5 pages in Internet Explorer by rendering the new HTML5 elements in a proper format in both screen and also in print. As the Internet Explorer 6, 7, and 8 do not recognize new HTML5 elements. IE treats unknown element start <section> and end </section> tags as void elements. This means unknown elements no longer wrap their contents or won’t format the page well and making them impossible to style and spilling their contents into the DOM.

How exactly IE Print Protector works?

To display the new HTML5 elements in almost all the IE browsers, IE Print Protector uses a shim, a piece of JavaScript which forces support for HTML5 elements in all the versions of Internet Explorer.

How HTML5 elements are rendered?

This is what IECSS team explains: To display elements correctly in print, IE Print Protector temporarily replaces HTML5 elements with  supported fallback elements (like div and span) when you print. IE Print Protector also creates a special style sheet or css for these elements based on your existing styles; this means you can safely style HTML5 elements by element name in links, styles, @imports and @media. Immediately after, IE Print Protector restores the original HTML5 element to the page, right where you left it. Any references to those elements and any events on those elements will remain intact.

Check out their example HTML5 page with IE Print Protector.

If you found this interesting Рyou can give it a try by downloading  the IE Print Protector Javascript here. And why not share your thoughts about this cool tool.

Published by Sravan Kumar

A Creative Web Designer, Developer, User Interface and User Experience Expert.

Leave a comment

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

This site uses Akismet to reduce spam. Learn how your comment data is processed.

Thank you for sharing the article across social media. You can follow us in these paltforms to receive latest updates from WittySparks.

Send this to a friend