Question

Our dev shop continues to support IE6 etc. I'm wanting to use session storage to make an app-cache but wondering how much work it would be...

Is it possible to use an HTML4 doc type in an HTML5-compatible browser and still access the sessionStorage, or do I have to browser sniff and return different pages (perhaps just with doctype alteration) to get it to work?

Was it helpful?

Solution

Actually, you can. Browsers don't care about doctypes. HTML 4 strict or HTML 5 won't make a difference, just make sure your page is in Standards Mode, not Quirks Mode.

Personally, I don't see a reason not to use the HTML5 doctype, as you would be using HTML5, and, unlike any of the others, you can remember it!

Of course, session storage as defined in HTML5 won't work in IE6—but it is up to you to decide what kind of fallback you'll provide.

OTHER TIPS

Good question... theoretically the answer is no, but practically it's vendor dependent. My solution would be to have the server check the user-agent and dynamically tag the page accordingly to what you find out when testing cross-browser implementation. Unfortunately this is one of those things you can't do dynamically on the client (change doc type) as you would with Javascript implementation fixes.

Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow
scroll top