Html5 compatability

how to make html5 codes work in older browsers?
l

Which older browsers and why?

99% of browsers support HTML5. Those that don’t understand the new HTML5 tags won’t understand much css3 either so your question is a little too vague to answer.

The standard way to do this was HTML5 Shiv.

Yes that is only needed for ie8 and under and the usual way to include it was like so.

<!-- if using any html5 elements this file must be added for IE8 and under -->
<!--[if lt IE 9]>
<script type="text/javascript" src="http://cdnjs.cloudflare.com/ajax/libs/html5shiv/3.7.3/html5shiv.js"></script>
<![endif]-->

However IE8 doesn’t understand media queries either so you would also need to add media query support for that browser which can be done using respond.js

<!-- respond js for media query support in ie8 follows immediately after css files-->
<script type="text/javascript" src="js/respond.src.js"></script>

The bigger question is whether it is worth putting all that junk in your html when there are very few browsers left that need it and indeed actively supporting insecure browsers should be discouraged.

I used to support all browsers but after the reason spate of ‘ransomware’ attacks which specifically target outdated and vulnerable browsers I no longer think it wise to support any browser that is no longer updated by its manufacturer.

3 Likes

HTML5 support is one thing, but CSS3 is a whole other topic.
My take on this was that (provided you took the “desktop first” RWD approach), mobiles using >IE9 would be too few and far between to even consider. (Now you could say the same for desktops.)
Then many of the more “decorative” CSS properties (as opposed to those who’s absence is detrimental to layout and readability), such as border radius, shadows and gradients, well they can just live without those.

But as you say, support for those legacy browsers is much less important now and probably should not be encouraged, unless the OP has a specific, good reason for it.

1 Like

Yes, that’s what I was getting at :slight_smile:

Most of the people who talk about html5 mistakenly think that CSS3 is the same thing so I was just making the distinction. Many of the tutorials around lump them together.

Yes that’s basically what we used to do in olden days :slight_smile: Everyone was saying go mobile first but you ended up with 90% of your audience (IE users) getting the mobile view on large desktops.

I’m glad those days are gone :wink:

2 Likes

No need to optimize code for old browsers…peoples are using latest browser…

This topic was automatically closed 91 days after the last reply. New replies are no longer allowed.