Forum Moderators: open
javascript:alert(document.compatMode); to determine if IE is forced into Quirks mode. IE and Firefox now displays a JS alert box with "CSS1Complat" which I understand to be Standards Compliant Mode. Is this correct? Quirks mode displays "Backpat". When pasting this JavaScript into Safari it just displays and alert box with the message "Undefined". How can I tell what mode Safari renders the page in? The reason being that Safari displays some pages perfectly (with a 100% height background image), and others not 100% height. My main question however is to determine the docType, so please don't focus on the height issue. Thanks.
Added:
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<?xml version="1.0" encoding="iso-8859-1"?>
[edited by: SilverLining at 9:22 am (utc) on May 18, 2007]
A more friendly method to detect the rendering mode...
<a href="#" onclick="javascript:m= ( document.compatMode == 'CSS1Compat' )? 'Standards' : 'Quirks'; window.alert('Page rendered in '+m+'-mode.'); return false;">Detect Render Mode</a>
I'm not sure about Safari's rendering mode, don't have a grand for a MAC. If you're using it you could try viewing the page's properties, information, or hover your mouse over it's TAB like in Opera or Gecko though these are just guesses.
XHTML is a subset of XML so you should not logically serve the XML declaration after the DTD declaration but before it.
- John
Initially I had the XML declaration before the DTD, but according to Setek's post [webmasterworld.com] (post #3259606) on the CSS forum, this forces IE into Quirks mode and for that reason I changed the order of the two.
The fact that the XML declaration is incorrectly placed under the doctype (causing a parsing error) is the most likely reason why Safari is using quirks mode.