sending the w3c validator different mime types
Posted: Tue Feb 24, 2009 7:04 pm
Hello,
I am attempting to generate code which will allow users to check my pages with the w3c validator. Right now, I have the following code:
While the above code does generate a link which asks the validator to check the page, the validator always checks the xhtml 1.1 version rather than the html 4.01. I've configured my pages to be sent as application/xhtml+xml to user agents which accept that mime type and text/html to the others. At the footer of my pages, the
image appears when visitors view the site through an application/xhtml+xml capable browser (such as Firefox), but page viewers seeing the site through a browser which does not understand real xhtml (like Internet Explorer), users see the image
instead.
Here is what I want to be able to have:
1. Code which can tell the validator to check the referring page
The above code does meet this need
2. Code which displays
to users receiving the text/html (and html 4.01) version of the page and which displays
to users receiving the application/xhtml+xml (with an xhtml 1.1 configuration).
The above code does meet this need
3. Code which causes the validator to receive the text/html version when the
image is clicked and causes the validator to receive the application/xhtml+xml version when the
image is clicked.
The above code does not meet this need
Right now, the validator always receives the xhtml version and validates it in that way. It would be confusing for someone to click
and, on the next page, read "This document was successfully checked as XHTML 1.1" While this issue may not matter to some, it is one which I would like to resolve if possible.
Is there a way to send the validator same mime type (and code) that the current user has received?
I am attempting to generate code which will allow users to check my pages with the w3c validator. Right now, I have the following code:
Code: Select all
<p><a href="http://validator.w3.org/check?uri=<?php $url = "http://".$_SERVER['HTTP_HOST'].$_SERVER['SCRIPT_NAME'];
echo $url; ?>">
<?php if (!empty($_SERVER["QUERY_STRING"]))
$url .= "?".$_SERVER['QUERY_STRING'];
if($mime == "application/xhtml+xml") {
$validate_type = "<object width=\"88px\" height=\"31px\" type=\"image/png\" data=\"http://www.w3.org/Icons/valid-xhtml11.png\">Valid xhtml 1.1</object>";
} else {
$validate_type = "<object width=\"88px\" height=\"31px\" type=\"image/png\" data=\"http://www.w3.org/Icons/valid-html401.png\">Valid html 4.01</object>";
}
print $validate_type; ?></a></p>While the above code does generate a link which asks the validator to check the page, the validator always checks the xhtml 1.1 version rather than the html 4.01. I've configured my pages to be sent as application/xhtml+xml to user agents which accept that mime type and text/html to the others. At the footer of my pages, the
Here is what I want to be able to have:
1. Code which can tell the validator to check the referring page
The above code does meet this need
2. Code which displays
The above code does meet this need
3. Code which causes the validator to receive the text/html version when the
The above code does not meet this need
Right now, the validator always receives the xhtml version and validates it in that way. It would be confusing for someone to click
Is there a way to send the validator same mime type (and code) that the current user has received?