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.
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.
Yes, thatâs what I was getting at
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 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
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.