Question

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.org/TR/html4/strict.dtd">
<html lang="en" xmlns="http://www.w3.org/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 command?

Was it helpful?

Solution

There 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.

OTHER TIPS

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 comments 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 comments?

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 company 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.com/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.

Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow
scroll top