: How do I serve XHTML to Internet Explorer without breaking Chrome? I run a forum which serves its pages as XHTML+MathML+SVG; in full: <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.1 plus MathML
I run a forum which serves its pages as XHTML+MathML+SVG; in full:
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.1 plus MathML 2.0 plus SVG 1.1//EN" "http://www.w3.org/2002/04/xhtml-math-svg/xhtml-math-svg-flat.dtd">
Using the MathPlayer plugin, Internet Explorer users can use this site. However, sometimes someone is using the forum from IE and isn't able to install MathPlayer (maybe they're on a public machine somewhere). Then IE (at least 6&7) complains about the XHTML and offers just to download the file.
I read on the w3c site how to get around this using an XSL transformation (http://www.w3.org/MarkUp/2004/xhtml-faq#ie). When I put this in place, I found that Chrome was now complaining vociferously about undefined entities (the specific one was but testing shows that that's not relevant).
Bizarrely, I can get round this by manually declaring the entities in the DOCTYPE:
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.1 plus MathML 2.0 plus SVG 1.1//EN" "http://www.w3.org/2002/04/xhtml-math-svg/xhtml-math-svg-flat.dtd" [
<!ENTITY nbsp " ">
]>
but I'd rather not do this for the whole gamut of entities possible. I say "bizarrely" because the XHTML+MathML+SVG dtd does, as far as I can see, declare these entities. So somehow these are getting missed out.
Is there a way around this problem? Can I serve XHTML-with-entities to IE?
In case it matters, the pages are generated by a php script and are served via apache, so if there's a reliable method of sniffing the browser and modifying the start of the document (so only sending the <?xml-stylesheet ...> bit to IE) then that would be an acceptable alternative.
(I hope I have the right SE site ... please let me know if I'm in the wrong place. Ditto with the tags.)
More posts by @Odierno851
1 Comments
Sorted by latest first Latest Oldest Best
[I]f there's a reliable method of sniffing the browser and modifying the
start of the document (so only sending the bit
to IE) then that would be an acceptable alternative.
This PHP statement will match any browsers which include "MSIE" in the user agent string and you could refine the criteria by adding a version number, if desired:
$flag_is_ie = (false !== strpos($_SERVER['HTTP_USER_AGENT'], 'MSIE'));
... with version numbers:
$flag_is_ie = (false !== strpos($_SERVER['HTTP_USER_AGENT'], 'MSIE 6.'));
$flag_is_ie = ( $flag_is_ie || (false !== strpos($_SERVER['HTTP_USER_AGENT'], 'MSIE 7.')));
Terms of Use Create Support ticket Your support tickets Stock Market News! © vmapp.org2024 All Rights reserved.