I'm working within the parameters of an un-reachable developer, whom has created an html generation system for our products.. Whenever a new page is generated he places:
<!-- updated page at 05/MAY/2010 02:58.58 -->
<!-- You must use the template manager to modify the formatting of this page. -->
resulting in my code looking like:
<!-- updated page at 05/MAY/2010 02:55.30 -->
<!-- You must use the template manager to modify the formatting of this page. -->
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01//EN" ".dtd">
<html lang="en" xmlns="" xml:lang="en">
I don't believe IE read's this doctype at all, as when looking at the developer screen, it renders in Quirks mode... is there any other way to force IE out of this horrible Quirks mode? I've been trying to reach the developer but he has been rather un-available..
Thank you in advance for any help you might have to offer.
//EDIT:
Is this possible to do via javascript, to hit the parent page with an on load mand?
I'm working within the parameters of an un-reachable developer, whom has created an html generation system for our products.. Whenever a new page is generated he places:
<!-- updated page at 05/MAY/2010 02:58.58 -->
<!-- You must use the template manager to modify the formatting of this page. -->
resulting in my code looking like:
<!-- updated page at 05/MAY/2010 02:55.30 -->
<!-- You must use the template manager to modify the formatting of this page. -->
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01//EN" "http://www.w3/TR/html4/strict.dtd">
<html lang="en" xmlns="http://www.w3/1999/xhtml" xml:lang="en">
I don't believe IE read's this doctype at all, as when looking at the developer screen, it renders in Quirks mode... is there any other way to force IE out of this horrible Quirks mode? I've been trying to reach the developer but he has been rather un-available..
Thank you in advance for any help you might have to offer.
//EDIT:
Is this possible to do via javascript, to hit the parent page with an on load mand?
Share Improve this question edited May 5, 2010 at 3:35 Petrogad asked May 5, 2010 at 3:16 PetrogadPetrogad 4,4235 gold badges40 silver badges78 bronze badges 1- This is some kind of late, but the problem is the ments in front of doctype. This causes IE to switch into quirksmode. – Stefan Steiger Commented Sep 6, 2012 at 7:17
5 Answers
Reset to default 2There is nothing you can do. Your content management system is failing. You either need to find the developer and have them fix this faulty system or get a new content management system.
You can force IE to use standards mode by adding
<meta http-equiv="X-UA-Compatible" content="IE=8" />
to the beginning of your head section for the HTML, or you can add the equivalent HTTP header via server configuration. This will only work on IE8 or above, however.
How are the pages being generated?
If you are using PHP, you could use output buffering to keep the template ments from being output.
If you are stuck with that code, then why not add a last step to the build process, one that strips these ments?
Yes it is possible, it's a very bad thing to do though.
UPD. Sorry, nope it doesn't work.
But in some cases, we simply don't have control over what is served to the user. Typical situation: a payments gateway that your pany is obliged to use for some legal reason. They allow you to style the page and to put your own contents in it, but they don't allow to change or how the doctype is being set (and it's not being set at all!).
So, inspired by this link: http://www.webmasterworld./forum91/4856.htm and beautified solution would probably be something like this (put it before your closing body tag </body>
):
<!--[if IE]>
<script>
!function() {
var doctype = "<!DOCTYPE html>",
headHTML = document.head.outerHTML,
bodyHTML = document.body.outerHTML;
window.doctypeSet = false;
if (window.doctypeSet) return;
setTimeout(function(){
document.write(
doctype +
"<html>" +
headHTML +
bodyHTML +
"</html>"
);
window.doctypeSet = true;
}, 0);
}();
</script>
<![endif]-->
However, you might also want to change <!--[if IE]>
to something like <!--[if lte IE 9]>
, so that IE10 and later doesn't perform this dirty dance. I am not sure if IE10 will also switch to quirksmode if doctype is not present, if it's not switching, then there is no need to do have this code invoked there.