Forum Moderators: open
I've just started writing an rss feed and I really like the way that if I make a mistake - for instance I write the ampersand as & instead of & - my Mozilla add-on won't show the feed.
There's far too much rubbish on the web. I'd like to spend a week with access only to pages which comply to standards.
I'd also like to feel superior with regard to my own site versus my big corporate competitors >;->
[edited by: ronin at 7:13 pm (utc) on Mar. 14, 2004]
For your own site(s), if you're doing XHTML you can force yourself to build only valid pages by send them with the mime type
application/xhtml+xml to browsers like Mozilla which can cope with it. If your page is invalid or valid but not well-formed, you will get an XML error message rather than your site. To do this, you can use mod_rewrite or a scripting language. You check for the HTTP_ACCEPT from the browser, and if it includes
application/xhtml+xml, you're set. For IE and older browsers, you send it as text/html. Method one is with mod_rewrite: Options +FollowSymLinks
RewriteEngine on
RewriteBase /
RewriteCond %{HTTP_ACCEPT} application/xhtml\+xml
RewriteCond %{HTTP_ACCEPT}!application/xhtml\+xml\s*;\s*q=0
RewriteCond %{REQUEST_URI} \.html$
RewriteCond %{THE_REQUEST} HTTP/1\.1
RewriteRule .* - [T=application/xhtml+xml]
That rewrites all .html files with the mime-type
application/xhtml+xml. Method two is with something like PHP: <?php
if ( stristr($_SERVER["HTTP_ACCEPT"],"application/xhtml+xml") ) {
header("Content-type: application/xhtml+xml");
}
else {
header("Content-type: text/html");
}
?>
As I said, if you do this, one tiny error and your site won't display in Mozilla. If you do this on an commercial site, you're insane. ;)
Of course, you should remember one of the basic rules of the web: be strict in what you do, but be lenient with what you accept from others.
Of course, you should remember one of the basic rules of the web: be strict in what you do, but be lenient with what you accept from others.
I find myself more humble after reading this piece of wisdom. Thanks for reminding me of which way the path runs.
Nevertheless, just for fun, I would like to use a browser which refuses to display any site which is not standards compliant. I verify my own pages religiously anyway, but it would also be useful to browse my own site to see if there were any pages I'd missed...
I checked the Mozilla extensions page in the hopes that there might be a developer extension that does what I'm looking for but no luck.
Does anyone have any ideas? Thanks.
As for WebmasterWorld, for the forum index, you're in luck! As for the posts, it's less certain - as for any site with user input, you can't guarantee the validity of the code. I can simply do some improper nesting of <b> and <i> tags and break the page ;)
Unfortunitely, most (if not all) major sites still use text/html, which implies the content may not be well formed, even if the content claims to be XHTML.
Jon.
ps, by using &amp; it sounds like you encoding HTML inside XML - it is debatable if this is a good idea:
www.xml.com/pub/a/2003/08/20/embedded.html
With some web-servers (I use Xitami on Windows), you may be able to trigger this mime-type as simply as renaming your .html file to .xhtml
For rss, I'm not so sure, so I guess you'll have to try some of the other suggestions. I wish you luck, and applaud your initiative.
So, no Google, no Yahoo, no MSN, no online newspapers
I know! Doesn't it sound refreshing? It's like tipping all the rubbish out of the garage. It'll be like 1995 all over again.
p.s. py9jmas > I take your point. No I certainly wouldn't set about encoding html inside xml, that's just ugly. However I might want to write '&' in my rss feed and the only way to do this as far as I've figured out is to write: '&amp;' - which I think is a bit silly... but better than nothing at all.