Dev Depot: HTML5 Shiv, Backwards Compatibility

Of all the current coding technologies holding the most promise for the future, HTML5 leads the way — but despite its potential, many developers shy away from upgrading their infrastructure to HTML5 — often using the excuse of incompatibility with older browsers to cover for an unwillingness to adapt or to learn new techniques.

This reluctance does have a legitimate foundation, however, as new elements are not recognized by older web browsers, cannot hold child elements, and are not affected by CSS styles, hindering HTML5’s adoption by many coders.

HTML5 Shiv enables the use of HTML5 sectioning elements in legacy Internet Explorer variants and provides basic HTML5 styling for Internet Explorer 6-9, Safari 4.x (and iPhone 3.x), and Firefox 3.x.

Programmer Sjoerd Visscher stumbled upon a workaround, and later posted the tip in a comment on W3C HTML WG co-chair Sam Ruby’s blog, stating, “BTW, if you want CSS rules to apply to unknown elements in IE, you just have to do document.createElement(elementName). This somehow lets the CSS engine know that elements with that name exist.”

The response from the stunned coding community was swift, as the implications became clear.

“I want to jam standards support into (this and future versions of) Internet Explorer,” John Resig stated, coining the term “HTML5 Shiv,” and notes, “If a shiv is the only pragmatic tool I can use to do so, shouldn’t I be using it?”

You should be using it too.

Fortunately, several solutions are available for helping cautious coders to explore this new frontier.

For example, the HTML5 Shiv (Code.Google.com/p/html5shiv) lets webmasters make their HTML5-based websites more backwards compatible with older browsing software that does not natively support the latest HTML5 web development standard by inserting a level of support via a JavaScript file.

According to a rep, the HTML5 Shiv enables the use of HTML5 sectioning elements in legacy Internet Explorer variants and provides basic HTML5 styling for Internet Explorer 6-9, Safari 4.x (and iPhone 3.x), and Firefox 3.x.

Using the html5shiv is as easy as downloading a zip file and then inserting a call to the shiv's minified distribution within the web page's <head> element, either before or after the CSS calls. Here is the code:

<!--[if lt IE 9]>
<script src="html5shiv.js"></script>
<![endif]-->

“It must be included before the element (i.e. in the <head>) but it doesn’t matter if it appears before or after the CSS,” a rep advises. “But for the sake of performance it would make better sense to include the CSS first then this script.”The html5shiv is dual licensed under the MIT or GPL Version 2 licenses and the full, uncompressed source code is available, adding new HTML5 elements, and supports the printing of HTML5 elements, including default styles for elements such as “display: block” in HTML5’s article and section tags.

The publisher also addresses a common question: what is the difference between the html5shim and the html5shiv? The answer: nothing — one has an “m” and one has a “v” — that is it, so if you see information referring to html5shim, it is the same thing with a different name.

Because only Internet Explorer 9 or less will call the html5shiv code, it does not affect the performance of your site with other browsers, making the addition of this free script a no-brainer.

Related:  

Copyright © 2025 Adnet Media. All Rights Reserved. XBIZ is a trademark of Adnet Media.
Reproduction in whole or in part in any form or medium without express written permission is prohibited.

More Articles

profile

WIA: Sara Edwards on Evolving Clip Culture and Creator Empowerment

Though she works behind the scenes, Sara Edwards has had a front-row seat to the evolution of adult content creation. Having been immersed in the sector since 1995, she has a unique perspective on the industry.

Jackie Backman ·
profile

Segpay Marks 20 Years of High-Risk Triumphs

Payment processors are behind-the-scenes players in the world of ecommerce, yet their role is critical. Ensuring secure, seamless transactions while navigating a rapidly changing regulatory landscape requires both technological expertise and business acumen.

Jackie Backman ·
opinion

The SCREEN Test: How to Prepare for Federal Age Verification

For those who are counting, there are now 20 enacted state laws in the United States requiring age verification for viewing online adult content, plus numerous proposed laws in the works. This ongoing barrage has been exhausting for many in the adult industry — and it may be about to escalate in the form of a potential new AV law, this time at the federal level.

Corey D. Silverstein ·
opinion

How to Master Team Dynamics for Business Success

Having the right team in place is everything. Whether getting a startup off the ground and thriving, or safeguarding an established company, the right — or wrong — people can mean the difference between a successful venture and a failed dream.

Juicy Jay ·
opinion

Eight Steps to Fast-Track AI Site Approval for Processing

Artificial intelligence is a hot topic these days. AI technology is speeding up the way we do business across all industries and offers numerous benefits, from automating processes to increasing efficiency and scalability.

Cathy Beardsley ·
opinion

How to Secure High-Risk Transactions With Network Tokenization

Ensuring the security of data as it moves through digital channels is the foundation of safe transactions, and crucial for your success. If your business can’t secure transactions, you’re exposed to myriad processing traumas.

Jonathan Corona ·
profile

WIA Profile: Reba Rocket

As chief operating officer and chief marketing officer of Takedown Piracy, long at the forefront of intellectual property protection in adult entertainment, Rocket is dedicated to safeguarding the livelihoods of content creators and producers while fostering a more ethical and sustainable industry.

Women In Adult ·
opinion

Protecting Content Ownership Rights When Using AI

In today’s digital age, content producers have more tools at their disposal than ever before. Among these tools, artificial intelligence (AI) content generation has emerged as a game changer, enabling creators to produce high-quality content quickly and efficiently.

Corey D. Silverstein ·
opinion

How Payment Orchestration Can Help Your Business

An emerging payment solution is making waves in the merchant world: the payment orchestration platform (POP). It’s quickly gaining traction as a powerful tool for managing online payments — but questions abound.

Cathy Beardsley ·
opinion

Fine-Tuning Refund and Cancellation Policies

For adult websites, managing refunds and cancellations isn’t just about customer service. It’s a crucial factor in maintaining compliance with the regulations of payment processors and payment networks such as Visa and Mastercard.

Jonathan Corona ·
Show More