Welcome to WebmasterWorld Guest from 54.145.174.178

Forum Moderators: incrediBILL

Message Too Old, No Replies

How do you detect ie rendering mode

I'm sure this is obvious or answered but can't find it

   
3:02 am on Oct 10, 2003 (gmt 0)

10+ Year Member



I'm trying to figure out how to tell for any given page whether ie6 is rendering in quirks mode or strict mode. Is there a favelet or something that will do it?

I started a page like this:

<?xml version="1.0" encoding="iso-8859-1"?>
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">

thinking it would trigger standards compliance mode, but I'm having some weird problems.

Thanks,
Adam

4:07 am on Oct 10, 2003 (gmt 0)

10+ Year Member



What type of problems are you having with this?

Mac

7:29 am on Oct 10, 2003 (gmt 0)

10+ Year Member



Remove the XML prolog
(<?xml version="1.0" encoding="iso-8859-1"?> )

IE is stupid and doesn't understand it and jumps into quirks mode.

8:40 am on Oct 10, 2003 (gmt 0)

WebmasterWorld Senior Member 10+ Year Member



Here is a favlet based on NickH's info about the compatMode property. It also works in Opera and Mozilla, BTW.

javascript:(function(){var mode=document.compatMode,m;if(mode){if(mode=='BackCompat')m='Quirks';else if(mode=='CSS1Compat')m='Standards Compliance';else m='Almost Standards Compliance';alert('The document is being rendered in '+m+' Mode.');}})();

Jordan

2:28 pm on Oct 10, 2003 (gmt 0)

10+ Year Member



Thanks Jordan, that's just what I needed. Sorry for my ignorance, but how do I put that into the favorites to make it run. I love the way you can just right-click in firebird to see the mode.

Jobarr, will removing the xml declaration mess anything else up? I thought it was needed for validation.

The problems are just differences in positioning between opera/mozilla and ie6.

Thanks,
Adam

9:58 pm on Oct 10, 2003 (gmt 0)

10+ Year Member



No, the prolog is optional. As long as the doctype is there it should render in standards compliance mode.
10:17 pm on Oct 10, 2003 (gmt 0)

WebmasterWorld Senior Member 10+ Year Member



Hey Adam, just create a fluff favorite for any site you want, then go edit your favorites and change the name of it to something more appropriate, then paste all the code from javascript:...(); as the URL. Then save your favorites and try clicking on the new one from the favorites menu and you should get the document mode for whatever page you are looking at at the time it is run. :)

Jordan

10:47 pm on Oct 10, 2003 (gmt 0)

10+ Year Member



Thanks,
Works like a charm (really).

The document is being rendered in quirks mode

All beautiful valid pages are rendered in quirks mode. I have a feeling it's going to be a long weekend.

Adam

 

Featured Threads

Hot Threads This Week

Hot Threads This Month