What is it?
HTML5 Shiv allows versions of Internet Explorer prior to version 9 to recognize the HTML5 tags and allows them to be styled using CSS.
How to Implement HTML5 Shiv?
Using this on an HTML5 web page is simple; you may do so with or without installation of the library. Below is an example of how to conditionally include this only for Internet Explorer browsers less-than version 9.
<!DOCTYPE html> <html> <head> <!--[if lt IE 9]> <script src="//cdnjs.cloudflare.com/ajax/libs/html5shiv/r29/html5.min.js"></script> <![endif]--> </head> <body> </body> </html>
What do these files do?
html5shiv.js
- This includes the basic createElement() shiv technique, along with monkeypatches for document.createElement and document.createDocumentFragment for IE6-8. It also applies basic styling for HTML5 elements for IE6-9, Safari 4.x and FF 3.x.
html5shiv-printshiv.js
- This includes all of the above, as well as a mechanism allowing HTML5 elements to be styled and contain children while being printed in IE 6-8.
HTML5 Shiv Known issues and limitations
- The shivMethods option (overriding document.createElement) and the html5.createElement method create elements, which are not disconnected and have a parentNode
- The cloneNode problem is currently not addressed by HTML5 Shiv. HTML5 elements can be dynamically created, but can’t be cloned in all cases.
- The printshiv version of this has to alter the print styles and the whole DOM for printing. In case of complex websites and or a lot of print styles this might cause performance and/or styling issues. A possible solution could be the htc-branch of HTML5 Shiv, which uses another technique to implement print styles for Internet Explorer 6-8.