Forum Moderators: open
No problems with other browsers; I know IE doesn't like standards but this is ridiculous!
Is there anyway I can have all other browsers except IE see a doctype and even allow W3's validator to see the XHTML strict doctype but not IE? Rendering the page correctly is more important but...well you know.
It does depend on the exact Doctype you are aiming for transitional, frameset etc but maybe the following will help:
Check that you have this as the first line of each page:
<?xml version="1.1" encoding="iso-8859-1"?>
or
<?xml version="1.0" encoding="iso-8859-1"?>
and then for strict 1.1 make sure the Doctype reads:
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.1//EN" "http://www.w3.org/TR/xhtml11/DTD/xhtml11.dtd">
and for XHTML 1.0 transitional:
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
It is possible to get code that validates and displays iin both browsers - good luck
It is easy to test this, add the line and display the page. IE will be in quirks mode. Remove the line and put the content type in the <head> tag to serve the page as text/html:
<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
Check it again and it will now be in standards mode.
XHTML 1.0 MAY be served as 'text/html','application/xml,'text/xml', but it SHOULD be served as 'application/xhtml+xml. Unfortunately serving it as anything other than 'text/html' causes IE to switch to quirks mode. So for cross browser compatibility it is better to have them all in standards mode, to do that currently you must serve the XHTML as 'text/html'. XHTML 1.1 can not be served as 'text/html'and must use the <?xml version="1.0" encoding="iso-8859-1"?>. So any use of XHTML 1.1 will put IE in quirks mode, and if you serve 1.1 as 'text/html' all browsers will render it in quirks mode.
What I have found that works best for cross browser compatibility is to use XHTML 1.0 served as 'text/html'. It complies with the W3C standards, and all browsers will display it in standards mode. This minimizes the rendering differences between them. It will also be forward compatible for quite a while as new browser versions come out.
It's a confusing topic. Check out W3C, especially the W3C Notes sections, W3 Schools and the many other references on the web to learn more about it.
Create a bookmark (favorite) and use the following as the location:
javascript:(function(){var mode=document.compatMode,m;if(mode){if(mode=='BackCompat')m='Quirks';else if(mode=='CSS1Compat')m='Standards Compliance';else m='';alert('The document is being rendered in '+m+' Mode.');}})();
<a href="javascript:(function(){var mode=document.compatMode,m;if(mode){if(mode=='BackCompat')m='Quirks';else if(mode=='CSS1Compat')m='Standards Compliance';else m='';alert('The document is being rendered in '+m+' Mode.');}})();">IE Mode</a>
... and yes very cool. I hope IE will travel the same path as Netscape 4.