Is there a way to switch a page in quirksmode to standards mode using Javascript?
For example, assuming I have the following page with html in it. I\'ve tried the fo
or any variant will not work, because a tag causes the HTML parser to create an HTML element and a HEAD element if none exists. By the time an HTML element exists (even an implicit one), a DOCTYPE on the token stream is ignored.
Closing and reopening the document will just prevent parsing of any of the following HTML content.
The only way to use document.write
to output a DOCTYPE is to create a new blank document that you can write in.
Just solve this server-side.