Forum Moderators: open

Message Too Old, No Replies

Can you have strict rendering in Mozilla...?

Looking forward to a leaner web...

         

ronin

6:49 pm on Mar 14, 2004 (gmt 0)

WebmasterWorld Senior Member 10+ Year Member Top Contributors Of The Month



Does anybody know if there is an add-on for Mozilla Firefox which simply displays a default page: "This page is not W3C standards compliant" if it does not conform to the doctype?

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]

encyclo

7:06 pm on Mar 14, 2004 (gmt 0)

WebmasterWorld Senior Member 10+ Year Member



For sites other than ones you control, not that I know of, although there is a Mac browser (can't remember which) which shows a smiley face if the page validates, and a grumpy one if it doesn't...

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.

ronin

7:19 pm on Mar 14, 2004 (gmt 0)

WebmasterWorld Senior Member 10+ Year Member Top Contributors Of The Month



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.

encyclo

7:35 pm on Mar 14, 2004 (gmt 0)

WebmasterWorld Senior Member 10+ Year Member



OK, you want one week without visiting an invalid site... So, no Google, no Yahoo, no MSN, no online newspapers. You've got a few thousand personal blogs, for searching you could use AllTheWeb (err, scrub that - they're not valid any more). Or you could spend the week reading up on the latest standards at [w3.org...] .

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 ;)

py9jmas

7:35 pm on Mar 14, 2004 (gmt 0)

10+ Year Member



All the main web browsers (unlike a lot of rss aggregators) properly enforce XML well-formedness on content served as XML, ie at least Content-type application/xhtml+xml (which IE can't cope with), application/xml and text/xml.

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;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

asquithea

8:16 pm on Mar 14, 2004 (gmt 0)

10+ Year Member



As noted above, the application/xhtml+xml coupled with an appropriate DOCTYPE will trigger the strict rendering in Firefox (I built my site this way).

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.

ronin

8:19 pm on Mar 14, 2004 (gmt 0)

WebmasterWorld Senior Member 10+ Year Member Top Contributors Of The Month



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;amp;' - which I think is a bit silly... but better than nothing at all.