473,761 Members | 5,758 Online
Bytes | Software Development & Data Engineering Community
+ Post

Home Posts Topics Members FAQ

content negotiation and parsing page contents

I'm trying to undestand the impact of using content negotiation when
rendering my Web pages to various different browsers as I would like to
use the XHTML Strict DOCTYPE declaration. Reading the W3C guidelines,
if I render as 'text/html' then there are some backward compatibility
issues I need to worry about. Does this mean that the page must be
rendered in one way if I use the "applicatio n/xhmlt+xml" content type
and another if I use the "text/html" content type? This would mean
parsing of every page on the site.... Or, if I follow the backward
compatibility rules from the W3C, will it render properly regardless
of the content-type for a particular request?

Thanks

Feb 6 '06 #1
9 1953
wardy wrote:
I'm trying to undestand the impact of using content negotiation when
rendering my Web pages to various different browsers as I would like to
use the XHTML Strict DOCTYPE declaration. Reading the W3C guidelines,
if I render as 'text/html' then there are some backward compatibility
issues I need to worry about.
If you serve as text/html then some browsers will render the document in
ways you don't like (splattering the page with ">" characters whereever you
have an <img />, <br />, <hr /> and so on).
Does this mean that the page must be rendered in one way if I use the
"applicatio n/xhmlt+xml" content type and another if I use the "text/html"
content type?
If it is served as text/html then it will be parsed with a tag soup slurper.

If it is served as application/xhtml+xml then it will be parsed with an XML
parser (which means IE will prompt user's to download it, and Firefox won't
render it until the entire document is downloaded and parsed, and will spit
errors at the user instead of trying to recover if the document isn't well
formed).

There are no differences in how browsers are supposed to render XHTML and
HTML (although there /are/ rules as to how CSS is applied which could
influence the rendering (e.g. class selectors are HTML only and don't apply
to XHTML, and the root element is <html> instead of <body>).
This would mean parsing of every page on the site....
Browsers have to parse every page they display.
Or, if I follow the backward compatibility rules from the W3C, will it
render properly regardless of the content-type for a particular request?


No. At present, unless you have need of something that only XHTML can
provide on the client (like mixed-namespace documents), stick to HTML. (By
all means _write_ XHTML, but transform it to HTML before it gets to the
client).

The Mozilla FAQ states that the only reason application/xhtml+xml has a
higher quality value than text/html in the Accept request header, is so
that the browser will get MathML versions of documents. They advise the use
of HTML 4.01 Strict.

--
David Dorward <http://blog.dorward.me .uk/> <http://dorward.me.uk/>
Home is where the ~/.bashrc is
Feb 6 '06 #2
wardy wrote:
I'm trying to undestand the impact of using content negotiation when
rendering my Web pages to various different browsers as I would like to
use the XHTML Strict DOCTYPE declaration. Reading the W3C guidelines,
if I render as 'text/html' then there are some backward compatibility
issues I need to worry about.
Yep. It's not that onerous unless your pages are generated by XML
tools that don't grok "Appendix C". If that is an issue, filter them
through mod_xhtml. Or - if they're static - equivalent preprocessor.
Does this mean that the page must be
rendered in one way if I use the "applicatio n/xhmlt+xml" content type
and another if I use the "text/html" content type?


That's up to the user agent. Normal browsers are happy with text/html
and HTML 4, but will accept xhtml as a second choice. MSIE will _only_
accept xhtml when it's served as text/html+tagsoup. But if you're
(also) serving to non-browsers, you'll have to work with whatever
they like.

--
Nick Kew
Feb 6 '06 #3
David Dorward wrote:
(e.g. class selectors are HTML only and don't apply to XHTML [...]).


Since when? Class selectors apply to any XML document in which the UA
has namespace specific knowledge of a class attribute. The spec
explicitly states that and goes on to provide examples of the SVG and
MathML class attributes, so there is no reason why they don't apply to
XHTML.

--
Lachlan Hunt
http://lachy.id.au/
http://GetFirefox.com/ Rediscover the Web
http://GetThunderbird.com/ Reclaim your Inbox
Feb 6 '06 #4
Lachlan Hunt wrote:
David Dorward wrote:
(e.g. class selectors are HTML only and don't apply to XHTML [...]).
Since when?


Since CSS 2.

"For style sheets used with HTML"

-- http://www.w3.org/TR/CSS2/selector.html#class-html
Class selectors apply to any XML document in which the UA
has namespace specific knowledge of a class attribute.


Ah. I see they've changed that in CSS 2.1, thank goodness for that. Still a
working draft though.
--
David Dorward <http://blog.dorward.me .uk/> <http://dorward.me.uk/>
Home is where the ~/.bashrc is
Feb 7 '06 #5
Great....thanks for the info all. I thought that I had read that
rendering XHTML to MSIE as text/html actually invokes almost standards
mode, and not quirks/tag soup mode. Is that not correct?

When rendering XHTML as text/html, would I need to worry about putting
the meta tag for the content type if I am already setting this in th
headers on the server? I wouldn't think so, but then how do I indicate
to use a different charset than the default UTF-8 or UTF-16 designation
for a text/html page?

Thanks

Feb 8 '06 #6
wardy wrote:
Great....thanks for the info all. I thought that I had read that
rendering XHTML to MSIE as text/html actually invokes almost standards
mode, and not quirks/tag soup mode. Is that not correct?


AFAIK MSIE doesn't have an 'almost standards' mode, just standards and
quirks. And both (all three in other browsers) rendering modes are
HTML/tag soup rendering modes. Rendering XHTML as XHTML is something
else again.

Steve

Feb 8 '06 #7
On 8 Feb 2006, wardy wrote:
but then how do I indicate
to use a different charset than the default UTF-8 or UTF-16 designation
for a text/html page?


That depends on your server software; read
http://www.w3.org/International/O-HTTP-charset.html

There is no default encoding (charset) for a "text/html page".

--
All free men, wherever they may live, are citizens of Denmark.
And therefore, as a free man, I take pride in the words "Jeg er dansker!"

Feb 8 '06 #8
David Dorward wrote:
If you serve as text/html then some browsers will render the document in
ways you don't like (splattering the page with ">" characters whereever you
have an <img />, <br />, <hr /> and so on).


Yes, and if you don't wear the tinfoil hat then the Chinese Google Rays
will eat you.

In practice, out in the real world, this just doesn't happen. It
_could_ happen (apparently a variant of emacs that grew beyond reading
mail and sprouted a web client did this), but it's just not something
to worry about.

Feb 8 '06 #9
Andy Dingley wrote:
In practice, out in the real world, this just doesn't happen. It
_could_ happen (apparently a variant of emacs that grew beyond reading
mail and sprouted a web client did this)
Umm. No. That's emacs. And the standard web browser for emacs, and that's
just one example. Anything that deals with HTML as SGML will do that.
, but it's just not something to worry about.


Advantages of serving XHTML as text/html to the client: Zip
Disadvantages of serving XHTML as text/html to the client: Minor

The disadvantages outweigh the advantages. Welcome back HTML 4.01.
--
David Dorward <http://blog.dorward.me .uk/> <http://dorward.me.uk/>
Home is where the ~/.bashrc is
Feb 8 '06 #10

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

27
3076
by: Gene Ellis | last post by:
Something strange is happening, but I bet it is a quick fix. My favicon image is showing up in the URL bar, for a couple of seconds, but then it disappears and the default browser icon is displayed. When I reload the page, the same thing happens. The correct icon appears for a few seconds (while the page is loading), but then goes away. You can see that here: http://webdev.ucop.edu/tltc_ph2/index_icon.html
8
2748
by: Stromboli | last post by:
Hi, I have my site available in a couple of languages most of the files are indexf.html (french), indexi.html (italian) and indexde.html (german).. I'd like to start using multiviews but I've noticed that search engines don't index index.html.en but they do index index.en.html. My question is, how can I configure multiviews to deliver for example
9
1769
by: James Pickering | last post by:
(update with re-formulated PHP) The W3C Tutorial relating to content negotiation http://www.w3.org/2003/01/xhtml-mimetype/content-negotiation mostly relates to Apache. I am working on content-negotiation for my Zeus/3.4 Server. My interim goal is to serve XHTML 1.0 documents as Content-Type application/xhtml+xml -- with XML declaration -- to Firefox browsers and as text/html-- without XML declaration (in order to render in "standards"...
3
2104
by: dalyian39 | last post by:
Hello, I'm pretty new to PHP but I have a page, B.php, which runs fine, but I want to be able to call this as B (long story), i.e. http://mysite/B?foo=bar should be equivalent to calling http://mysite/B.php?foo=bar. I've tried creating a symlink on the filesystem B -> B.php but that just sends the text content of the B.php file itself back to the caller. (I kind of thought I'd get away with that =) )
64
6422
by: Manfred Kooistra | last post by:
I am building a website with identical content in four different languages. On a first visit, the search engine determines the language of the content by the IP address of the visitor. What the user sees is content in only one language at a time. He or she can then switch to another language and set this as the preferred language, but again he or she sees content in only this one other language. The question now is: How do I get search...
0
1810
by: alexsink | last post by:
I am trying to get apache content negotiation to redirect only zh-CN(mainland China, where Simplified Chinese translations are available) language types to Chinese web pages, and have all other variants of Chinese language tags(ie zh-TW) point to English-suffix pages. Our site currently has content negotiation set up for several other languages, and we have the corresponding html files for those languages being properly served. After...
5
3978
by: visu | last post by:
Hi this is a question asked in this group two years back.. No answer for this question till date. now i am in the same situation of the questioner.. to find a solution for this problem. Can any one help me in this regard.? The question is: ---------------------------------------------------------------------------------------------------- Wondering if anyone can tell me if it's possible to have Javascript
9
2986
by: pbd22 | last post by:
Hi. This is just a disaster management question. I am using XMLHTTP for the dynamic loading of content in a very crucial area of my web site. Same as an IFrame, but using XMLHTTP and a DIV. I got the core of the javascript from here: http://www.dynamicdrive.com/dynamicindex17/ajaxcontent.htm I noticed in the demo that sometimes the content takes a long
1
4697
by: Ken Fine | last post by:
I have been investigating programmatically downloading FLV content from various sites ("video scraping"??) Many interactive GUI tools do this, such as the Orbit downloader. At the heart of them are packet sniffers which inspect the ethernet traffic coming over the wire. I would like to do this noninteractively in code. There is a .NET specific flavor of WinPCap called SharpPCap: http://www.tamirgal.com/home/dev.aspx?Item=SharpPcap...
0
9554
marktang
by: marktang | last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However, people are often confused as to whether an ONU can Work As a Router. In this blog post, we’ll explore What is ONU, What Is Router, ONU & Router’s main usage, and What is the difference between ONU and Router. Let’s take a closer look ! Part I. Meaning of...
0
9811
tracyyun
by: tracyyun | last post by:
Dear forum friends, With the development of smart home technology, a variety of wireless communication protocols have appeared on the market, such as Zigbee, Z-Wave, Wi-Fi, Bluetooth, etc. Each protocol has its own unique characteristics and advantages, but as a user who is planning to build a smart home system, I am a bit confused by the choice of these technologies. I'm particularly interested in Zigbee because I've heard it does some...
0
8814
agi2029
by: agi2029 | last post by:
Let's talk about the concept of autonomous AI software engineers and no-code agents. These AIs are designed to manage the entire lifecycle of a software development project—planning, coding, testing, and deployment—without human intervention. Imagine an AI that can take a project description, break it down, write the code, debug it, and then launch it, all on its own.... Now, this would greatly impact the work of software developers. The idea...
1
7358
isladogs
by: isladogs | last post by:
The next Access Europe User Group meeting will be on Wednesday 1 May 2024 starting at 18:00 UK time (6PM UTC+1) and finishing by 19:30 (7.30PM). In this session, we are pleased to welcome a new presenter, Adolph Dupré who will be discussing some powerful techniques for using class modules. He will explain when you may want to use classes instead of User Defined Types (UDT). For example, to manage the data in unbound forms. Adolph will...
0
6640
by: conductexam | last post by:
I have .net C# application in which I am extracting data from word file and save it in database particularly. To store word all data as it is I am converting the whole word file firstly in HTML and then checking html paragraph one by one. At the time of converting from word file to html my equations which are in the word document file was convert into image. Globals.ThisAddIn.Application.ActiveDocument.Select();...
0
5266
by: TSSRALBI | last post by:
Hello I'm a network technician in training and I need your help. I am currently learning how to create and manage the different types of VPNs and I have a question about LAN-to-LAN VPNs. The last exercise I practiced was to create a LAN-to-LAN VPN between two Pfsense firewalls, by using IPSEC protocols. I succeeded, with both firewalls in the same network. But I'm wondering if it's possible to do the same thing, with 2 Pfsense firewalls...
0
5405
by: adsilva | last post by:
A Windows Forms form does not have the event Unload, like VB6. What one acts like?
1
3913
by: 6302768590 | last post by:
Hai team i want code for transfer the data from one system to another through IP address by using C# our system has to for every 5mins then we have to update the data what the data is updated we have to send another system
3
2788
bsmnconsultancy
by: bsmnconsultancy | last post by:
In today's digital era, a well-designed website is crucial for businesses looking to succeed. Whether you're a small business owner or a large corporation in Toronto, having a strong online presence can significantly impact your brand's success. BSMN Consultancy, a leader in Website Development in Toronto offers valuable insights into creating effective websites that not only look great but also perform exceptionally well. In this comprehensive...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.