Hello and welcome to our community! Is this your first visit?
Register
Enjoy an ad free experience by logging in. Not a member yet? Register.
Results 1 to 5 of 5
  1. #1
    New Coder
    Join Date
    Jan 2005
    Posts
    31
    Thanks
    1
    Thanked 0 Times in 0 Posts

    Identify rendering mode.

    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

  • #2
    Senior Coder ahallicks's Avatar
    Join Date
    May 2006
    Location
    Lancaster, UK
    Posts
    1,134
    Thanks
    1
    Thanked 57 Times in 55 Posts
    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
    "write it for FireFox then hack it for IE."
    Quote Originally Posted by Mhtml View Post
    Domains are like women - all the good ones are taken unless you want one from some foreign country.
    Reputation is your friend

    Development & SEO Tools

  • #3
    Regular Coder Jutlander's Avatar
    Join Date
    Jun 2007
    Location
    In my own sick little world :P
    Posts
    425
    Thanks
    1
    Thanked 12 Times in 12 Posts
    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
    .
    .

  • #4
    Supreme Master coder! _Aerospace_Eng_'s Avatar
    Join Date
    Dec 2004
    Location
    In a place far, far away...
    Posts
    19,291
    Thanks
    2
    Thanked 1,043 Times in 1,019 Posts
    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
    Code:
    <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
    Code:
    <!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01//EN">
    because its only a partial doctype not a full one.
    ||||If you are getting paid to do a job, don't ask for help on it!||||

  • #5
    New Coder
    Join Date
    Jan 2005
    Posts
    31
    Thanks
    1
    Thanked 0 Times in 0 Posts
    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


  •  

    Posting Permissions

    • You may not post new threads
    • You may not post replies
    • You may not post attachments
    • You may not edit your posts
    •