Should my page have HTML5 document type to access sessionStorage

Our dev store continues to support IE6, etc. I want to use session storage to create an application cache, but I wonder how much work will be ..

Is it possible to use the HTML4 document type in an HTML5 compatible browser and still access sessionStorage, or do I need to intercept the browser and return different pages (perhaps only with a change to the doctype type) to make it work?

+4
source share
2 answers

Actually, you can. Browsers don't care about docs. HTML 4 strict or HTML 5 won't make any difference, just make sure your page is in standard mode and not Quirks mode .

Personally, I see no reason not to use the HTML5 doctrine, since you will use HTML5, and, unlike any other, you can remember this!

Of course, the session store defined in HTML5 will not work in IE6, but it is up to you to decide which reserve you will provide.

+5
source

Good question ... theoretically, the answer is no, but in practice it depends on the supplier. My solution was for the server to check the user-agent and dynamically mark the page according to what you learned when testing the cross-browser implementation. Unfortunately, this is one of those things that you cannot do dynamically on the client (change the type of document), as well as with corrections of the Javascript implementation.

0
source

All Articles