...

View Full Version : Identify rendering mode.



Vijay Venkat
08-02-2007, 04:48 PM
Hi,
I have a html page in which there is a IFRAME.
The IFRAME- has the doctype to be XHTML transitional.
While the page does not have a doc type and i believe is rendering in quirks mode.

So does it mean that eventhough i specify that i want the contents in IFRAME to be rendered in XHTML Transitional mode, still it will render in quirks mode since the actual page is being rendered in quirks mode?

Can anyone clarify or lead me to any informatio on this.

Over and above how to know if the page is rendering in Quirks mode in IE?. In Firefox i can see the rendering mode using web developer plugin.

Is there any javascript variable to identify this, so that i can write a simple javascript function to identify the rendering mode.

Thanks,
Vijay Venkat

ahallicks
08-02-2007, 04:56 PM
Get the developer toolbar for Firefox and there are three ticks in the top right, for HTML, CSS and javascript. A tick in the first image denotes that the page is rendering in standards compliance mode. You could also use firebug and check the DOM for the page, which should tell you the same thing.

In your case I think you need a doctype for the page the frame is on. You could use a frameset doctype if you must use frames. As for javascript, I'll leave that to someone more able-bodied

Jutlander
08-02-2007, 04:57 PM
You can look at this chart a little down the page, it tells something about when and when an engine is not in quirksmode: http://en.wikipedia.org/wiki/Quirks_mode

_Aerospace_Eng_
08-02-2007, 05:12 PM
The iframe will render in XHTML transitional. It doesn't inherit what the parent page has. Why do you need a javascript function though if the page in the iframe will run in standards mode if you have a doctype on that page. It won't matter what the parent page is doing. You can use this

<script type="text/javascript">
function isQuirk()
{
return (document.compatMode == 'BackCompat') ? 'Document is in quirks mode.' : 'Document is not in quirks mode.';
}
window.onload = function()
{
alert(isQuirk());
}
</script>
Though this only gives you the right mode if no doctype is present even though a doctype like this can also put IE into quirks mode

<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01//EN">
because its only a partial doctype not a full one.

Vijay Venkat
08-03-2007, 04:05 PM
Hi All,
Thanks for letting me know the details. The script and the link gave me all the information that was required to a solve the problem.

_Aerospace_Eng_

The iframe will render in XHTML transitional. It doesn't inherit what the parent page has. Why do you need a javascript function though if the page in the iframe will run in standards mode if you have a doctype on that page. It won't matter what the parent page is doing.
A very important information i needed. Probably a very basic question, still i wasn't sure about it.

Thanks for the script, i needed this to identify, if IE Was rendering in Quirks mode. I knew it was, but dint know how to validate it.

Jutlander and ahallicks thanks for the pointer and information.

Actually i had the right DOCTYPE with the URL, unfortunately there was a comment that was being rendered before the DOCTYPE from the JSP which caused IE to switch to Quirks mode.

Again thanks a lot.

Vijay Venkat



EZ Archive Ads Plugin for vBulletin Copyright 2006 Computer Help Forum