I hope someone here can help me. I know that in IE 9, there is quirks mode and standard mode, if I do not define a doctype such as :
<!DOCTYPE html>
as the VERY FIRST line of my html, the browser will go into quirks mode.
Here is the problem, I’m writing something in HTML, which will then be embedded into another site(which I’ve checked, doesn’t have doctype declaration, the site belongs to my school so I have no way of changing it).
So in the end it will be something like this
<html> .... </html> //the original website code
<!DOCTYPE html>//my doctype declaration
<html>... </html> //my html code
As you can see, my DOCTYPE becomes useless.
And no, there is no way I can change the original html code nor can I force it to use iframe or anything else that might help me.
So my question is, is there anyone to force IE 9 to run in standard mode without DOCTYPE?
I have tried:
<html xmlns="http://www.w3.org/1999/xhtml"> //putting page in xhtml
<meta http-equiv="X-UA-Compatible" content="IE=9" />//forcing it like this
none of them worked for me.
Any ideas ?
Really appreciate any help at all at this point.
Thanks in advance!
EDIT:UPDATE :
Hi Everyone, Thanks for the help. I know that it is horrible practice to have < html > … < html > … < /html > … < /html >. However this is a limitation of my project and I have no control over it. Also, I can only manipulate the inner < html >..< /html >.
I searched around, and it seems like there is no “awesome” solution, as someone suggested, it might be possible to use Javascript to force IE 9 to run in standard mode, however that is not ideal for my project.
What I ended up doing was stripping my html page of css (so that it doesn’t matter if the browser runs in standard mode or not), instead, I added in-line styling (very basic ones) throughout the HTML as a painful work-around.
It seems like this is a corner-case that IE 9 didn’t anticipate, this problem doesn’t exist in Chrome, Firefox, IE 8, as I have tested.
Anyways, Thanks to everyone for the help!
Why without
<!DOCTYPE>? It is the worst idea to choose.The
<!DOCTYPE>declaration must be the very first thing in your HTML document, before the<html>tag. The<!DOCTYPE>declaration is not an HTML tag. It is an instruction to the web browser about what version of HTML the page is written in.A DOCTYPE (short for “document type declaration”) informs the validator which version of (X)HTML you’re using, and must appear at the very top of every web page. DOCTYPEs are a key component of compliant web pages: your markup and CSS won’t validate without them.
Good reads: