RE: Malware and Threads
December 18, 2012 at 10:05 am
(This post was last modified: December 18, 2012 at 10:10 am by Aractus.)
The purpose of XHTML is to be a reformulation of HTML. You can't just add the XHTML doctype tag into any HTML document and expect it to behave correctly. This is what 99% of developers do, and all it does it make an HTML 4 document with the wrong doctype. But this you know. XML speed is important for more limited devices like smartphones. I'll also point out that it consumes less memory than the same HTML document does. In a way I see HTML 5 as a huge step backwards when we could have simply moved forward with XHTML if people had actually known how to use it. The compatibility issues are far less than with traditional HTML.
Why don't I show you something a little more complicated:
That's what I use to determine if the document is sent as XML or not. And no part of it is plagiarized, FYI. XHTML behaves in different ways to HTML. But the compatibility is so easily managed, I don't think I can ever remember needing to use <!--[if ...]> outside of CSS, and even then only i I'm doing something silly like embedding fonts.
I can change this:
To this:
And it will make no difference. Yet if I change it to:
All hell breaks loose (the HTML parsing will cease at the self-closing script tag).
Why don't I show you something a little more complicated:
PHP Code:
<?
$uagent=$_SERVER['HTTP_USER_AGENT'];
$httphost='blog.aractus.com';
$base_url='http://'. $httphost. strtok($_SERVER['REQUEST_URI'],'?');
$usehtml=(stripslashes($_SERVER['QUERY_STRING'])=='html');
$usexhtml=(stripslashes($_SERVER['QUERY_STRING'])=='xhtml');
if(!$usehtml && !$usexhtml){
$usexhtml=stristr($_SERVER['HTTP_ACCEPT'],'application/xhtml+xml');
}
if ($usexhtml) {
$conttype='application/xhtml+xml';
$closetag=' />'. chr(10);
$dtype="<?xml version='1.0' encoding='utf-8'?>". chr(10). '<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN"'. chr(10). '"http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">';
$htmltg='<html xmlns="http://www.w3.org/1999/xhtml" xml:lang="en" lang="en">'. chr(10);
$framesc='<script type="text/javascript" src="/noframes.js" />'. chr(10);
$popup=' target="_blank"'. chr(10);
$btarget=' target="_top"';
}
else {
$usehtml=true;
$conttype='text/html';
$closetag='>'. chr(10);
$dtype='<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN"'. chr(10). '"http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">';
$htmltg='<html xmlns="http://www.w3.org/1999/xhtml" xml:lang="en" lang="en">'. chr(10);
$framesc='<script type="text/javascript" src="/noframes.js"></script>'. chr(10);
$popup=' target="_blank"'. chr(10);
$btarget=' target="_top"';
}
header('Content-type: '. $conttype);
?>
<?=$dtype. chr(10);?>
<?=$htmltg?>
<head profile="http://gmpg.org/xfn/11">
<?=$framesc?>
// .......
?>
I can change this:
Code:
$conttype='application/xhtml+xml';
Code:
$conttype='application/xml';
Code:
$conttype='text/html';