mozilla

Revision 90492 of Writing JavaScript for XHTML

  • Revision slug: Talk:Writing_JavaScript_for_XHTML
  • Revision title: Writing JavaScript for XHTML
  • Revision id: 90492
  • Created:
  • Creator: FunkyRes
  • Is current revision? No
  • Comment page created, 91 words added

Revision Content

Couple of notes :

1) The php example for detecting if the client accepts xhtml+xml will result in a php error of the client doesn't send what it accepts.

if (isset($_SERVER['HTTP_ACCEPT')) {
if( strpos( $_SERVER['HTTP_ACCEPT'], "application/xhtml+xml" ) ) {
  header( "Content-type: application/xhtml+xml" );
  echo '<?xml version="1.0" ?>'."\n";
} else {
  header( "Content-type: text/html" );
} else {
  header( "Content-type: text/html" );
}

solves that.

2) If you use the above trick, then you can't use the CDATA trick because it seems to cause issues in non xhtml+xml.

Revision Source

<p>Couple of notes :</p>
<p>1) The php example for detecting if the client accepts xhtml+xml will result in a php error of the client doesn't send what it accepts.
</p><pre class="eval">if (isset($_SERVER['HTTP_ACCEPT')) {
if( strpos( $_SERVER['HTTP_ACCEPT'], "application/xhtml+xml" ) ) {
  header( "Content-type: application/xhtml+xml" );
  echo '&lt;?xml version="1.0" ?&gt;'."\n";
} else {
  header( "Content-type: text/html" );
} else {
  header( "Content-type: text/html" );
}

solves that.
</pre>

<p>2) If you use the above trick, then you can't use the CDATA trick because it seems to cause issues in non xhtml+xml.</p>
Revert to this revision