问题
So i have another question. I made a page with a xhtml1 doctype.
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd">
And i put on that page a video element, and a form element thats using a placeholder. It would make sense to me that the video and placeholder wouldnt load/be recognized because i dont use a HTML5 doctype.
However, the opposite is true, its loaded as html5.
To add to that, i created an iframe in the xhtml1 page. I was wondering, what would happen if i would put an HTML5 page as a source inside that iframe. Concluding, it also loads as html5.
However, how can i make sure that the xhtml1 page doesnt load html5, and the iframe html5 page does?
I assumed the difference was the doctype, but maybe its something else? Browser? Or is there a repost somewhere making the browser initialize it as xhtml1, loading the iframe with html5, and returning the entire page as html5?
Does someone have information about this? And possibly a way to solve it?
Thank you for your help! :)
Ps: 1x xhtml1 page with iframe. (should only load xhtml1) 1x html5 page placed in the iframe. (should load html5) If everything is too confusing, i will post small code sampled to illustrate the problem. Just tell me.
回答1:
the type of content you put in header has nothing to do with the browser parsing the tags.
so if your html code has html5 tags, they will be executed as normal.
i don't see any way to stop this except by manually checking with code.
来源:https://stackoverflow.com/questions/12724828/html-4-iframe-with-html5-content