Help | Site Map
Connecting Tech Pros Worldwide
 
 
LinkBack Thread Tools
  #1  
Old July 20th, 2005, 08:19 PM
Bill Thoralina
Guest
 
Posts: n/a
Default XHTML rendering on browser

Hi,

I created an XHTML page, but for some reason it isn't rendering on my
browser. It is showing up as code.

Any suggestions? Thanks.
  #2  
Old July 20th, 2005, 08:19 PM
Brian
Guest
 
Posts: n/a
Default Re: XHTML rendering on browser

Bill Thoralina wrote:
[color=blue]
> I created an XHTML page, but for some reason it isn't rendering on my
> browser. It is showing up as code.[/color]

Not enough info. Is the browser IE? What is the declared content-type?
[color=blue]
> Any suggestions?[/color]

Yes. Give is a url, and tell us which browser (and os).

--
Brian (remove ".invalid" to email me)
http://www.tsmchughs.com/
  #3  
Old July 20th, 2005, 08:19 PM
Philipp Lenssen
Guest
 
Posts: n/a
Default Re: XHTML rendering on browser

Bill Thoralina wrote:
[color=blue]
>
> I created an XHTML page, but for some reason it isn't rendering on my
> browser. It is showing up as code.
>[/color]

Sounds like you send the correct content-type, and you are using buggy
Internet Explorer. You need to send XHTML files not as XML but as HTML
for 90%* of your users to see it.

*Approximation.

--
Google Blogoscoped
http://blog.outer-court.com
  #4  
Old July 20th, 2005, 08:19 PM
Lachlan Hunt
Guest
 
Posts: n/a
Default Re: XHTML rendering on browser

Bill Thoralina wrote:[color=blue]
> Hi,
>
> I created an XHTML page, but for some reason it isn't rendering on my
> browser. It is showing up as code.
>
> Any suggestions? Thanks.[/color]


First, you should validate your document and make sure it is infact
XHTML. Although I doubt this would prevent it from at least attempting
to render the HTML, it's always a good start to solving most problems.
http://validator.w3.org/

Otherwise, this can happen in the following situations:

If the document is being loaded from your local file system:
* Check that it doesn't have a .txt extension.
eg. file.html.txt or just file.txt, it will be treated as "text/plain"
in everything, except IE because it will attempt to sniff the document
and determine that it's HTML.
* If it has a .xml extension, and no doctype or namespace declared,
then you will see a document tree. IE will always show a document
tree for anything with a .xml extension, whether or not is has a
doctype and namespace. These files will be treated as either
text/xml or application/xml.

If this is being sent from a server
* Check that the server is sending the correct Content-Type header
eg. Content-Type: text/html or Content-Type: application/xhtml+xml,
etc…
If it's sending text/plain or text/xml or application/xml then see the
above reasons. The XML media types are also correct, and
should render correctly, however IE will incorrectly treat it as
plain XML and show you the docuement tree, unless you use Dean
Edward's recent hack which allows text/xml to render in IE.

If this doesn't help solve your problem, could you please send a URI
so we can see what is happening.

--
Lachlan Hunt
http://www.lachy.id.au/
lachlan.hunt@lachy.id.au.update.virus.scanners

Remove .update.virus.scanners to email me,
NO SPAM and NO VIRUSES!!!

  #5  
Old July 20th, 2005, 08:19 PM
Kris
Guest
 
Posts: n/a
Default Re: XHTML rendering on browser

In article <egtIc.90786$sj4.53290@news-server.bigpond.net.au>,
Lachlan Hunt <lachlan.hunt@lachy.id.au.update.virus.scanners> wrote:
[color=blue]
> * Check that it doesn't have a .txt extension.
> eg. file.html.txt or just file.txt, it will be treated as "text/plain"
> in everything, except IE because it will attempt to sniff the document
> and determine that it's HTML.[/color]

If there is a browser that will treat it as plain text because of the
file extension, then it is likely to be IE. It is the content-type
header that first of all determines what kind of file it is. I can put
images online with the extension .txt and serve them as image/jpeg and
they will not be treated as plain text by most browsers. I will however
not do so, since IE is the triggerhappy partycrasher here.

--
Kris
<kristiaan@xs4all.netherlands> (nl)
  #6  
Old July 20th, 2005, 08:19 PM
Brian
Guest
 
Posts: n/a
Default Re: XHTML rendering on browser

Kris wrote:
[color=blue]
> Lachlan Hunt wrote:
>[color=green]
>> Check that it doesn't have a .txt extension. eg. file.html.txt or
>> just file.txt, it will be treated as "text/plain" in everything,
>> except IE because it will attempt to sniff the document and
>> determine that it's HTML.[/color]
>
> If there is a browser that will treat it as plain text because of
> the file extension, then it is likely to be IE.[/color]

We've had this discussion before. IE only considers the file extension
after other means have been tried. I might add that you snipped the
context. L Hunt was talking about opening a file on a local file
system, where file extension might have some meaning.
[color=blue]
> It is the content-type header that first of all determines what
> kind of file it is.[/color]

In a network situation, sure.
[color=blue]
> I can put images online with the extension .txt and serve them as
> image/jpeg and they will not be treated as plain text by most
> browsers. I will however not do so, since IE is the triggerhappy
> partycrasher here.[/color]

Have you tested this? MS claims that IE sniffs the content and guesses
the correct content-type. If I believe MS, the problem isn't as you
describe it. On the contrary: if you declare the content-type as
text/plain, IE may treat it as something else, e.g., image/jpeg.

--
Brian (remove ".invalid" to email me)
http://www.tsmchughs.com/
  #7  
Old July 20th, 2005, 08:28 PM
Keith Bowes
Guest
 
Posts: n/a
Default Re: XHTML rendering on browser

Philipp Lenssen wrote:[color=blue]
> Bill Thoralina wrote:
>
>[color=green]
>>I created an XHTML page, but for some reason it isn't rendering on my
>>browser. It is showing up as code.
>>[/color]
>
>
> Sounds like you send the correct content-type, and you are using buggy
> Internet Explorer. You need to send XHTML files not as XML but as HTML
> for 90%* of your users to see it.
>
> *Approximation.
>[/color]

Or can send it as application/xml as a cruel joke.

  #8  
Old July 20th, 2005, 08:28 PM
Ian
Guest
 
Posts: n/a
Default Re: XHTML rendering on browser

Bill Thoralina wrote:
[color=blue][color=green]
>> You need to send XHTML files not as XML but as HTML
>> for 90%* of your users to see it.[/color][/color]

I've heard the term "content negotiation" referred to as a
solution to this. I figure it involves having Apache serve
application/xhtml+xml to Mozilla/Opera/etc. and text/html to IE.
Is this a practical solution?

Ian
--
http://www.bookstacks.org/
  #9  
Old July 20th, 2005, 08:28 PM
Brian
Guest
 
Posts: n/a
Default Re: XHTML rendering on browser

Ian wrote:
[color=blue]
> Bill Thoralina wrote:
>[color=green][color=darkred]
>>> You need to send XHTML files not as XML but as HTML for 90%* of
>>> your users to see it.[/color][/color]
>
> I've heard the term "content negotiation" referred to as a solution
> to this. I figure it involves having Apache serve
> application/xhtml+xml to Mozilla/Opera/etc. and text/html to IE. Is
> this a practical solution?[/color]

Only if done very carefully. IE/Win does not include text/html in its
accept header (sic), and will thus happily accept xhtml that it cannot
parse. Thus, you have to look explicitly for application/xhtml+xml in
the header, and send text/html if it isn't there. Then you must
disable caching, so that IE/Win users don't get the appl...xml version
via a proxy cache.

In short, I don't recommend it. The costs are rather high, for very
little benefit. But ciwah regular Mark Tranchant managed to pull it
off without too much adverse effects.

http://tranchant.plus.com/notes/xhtml11

Call him brilliant, persistent, or crazy. I'd go for at least 2 of
them. ;-) His switcher works, but note the no-cache header.

--
Brian (remove ".invalid" to email me)
http://www.tsmchughs.com/
  #10  
Old July 20th, 2005, 08:29 PM
Ian
Guest
 
Posts: n/a
Default Re: XHTML rendering on browser

On Mon, 26 Jul 2004 20:36:24 -0400, Brian
<usenet3@julietremblay.com.invalid> wrote:
[color=blue]
>http://tranchant.plus.com/notes/xhtml11
>
>Call him brilliant, persistent, or crazy. I'd go for at least 2 of
>them. ;-) His switcher works, but note the no-cache header.[/color]

Thanks, Brian. I'll keep that in a cubbyhole until I become better
educated. :-)

Ian
--
http://www.bookstacks.org/
  #11  
Old July 20th, 2005, 08:29 PM
Claire Tucker
Guest
 
Posts: n/a
Default Re: XHTML rendering on browser

On Mon, 26 Jul 2004 20:36:24 -0400, Brian
<usenet3@julietremblay.com.invalid> wrote:
[snip!][color=blue]
>Then you must
>disable caching, so that IE/Win users don't get the appl...xml version
>via a proxy cache.
>[/color]

Theoretically, you should be able to send:
Vary: Accept
....in the response header so that caches either don't cache at all or
cache a different version for each unique Accept header. Of course, in
practice caches probably ignore this rule completely.

-Claire
  #12  
Old July 20th, 2005, 08:29 PM
Alan J. Flavell
Guest
 
Posts: n/a
Default Re: XHTML rendering on browser

On Tue, 27 Jul 2004, Claire Tucker wrote:
[color=blue]
> Theoretically, you should be able to send:
> Vary: Accept[/color]

If you're negotiating on the Accept header, then it would indeed be
very remiss of you not to do so.
[color=blue]
> ...in the response header so that caches either don't cache at all or
> cache a different version for each unique Accept header.[/color]

Keep in mind that the client or proxy still has the option (if using
HTTP/1.1) to say to the server, "excuse me, I have this ETag on hand,
how would you feel if I used this to fulfil the request" and the
server can say either "go ahead" or "no, here's the correct variant".
Or in technical terms, an "if-any-match" request to the origin server.
[color=blue]
> Of course, in
> practice caches probably ignore this rule completely.[/color]

Of course, in practice HTTP/1.0 proxies will follow HTTP/1.0 rules;
whereas HTTP/1.1 proxies aren't mandated to use if-any-match requests:
it's optional.

But if everyone would follow the rules (if -only- everyone would
follow the interworking rules, instead of assuming that because
they're the biggest they have to be right), the results could be
correct, even when the response might be a bit slower than it had to
be.
  #13  
Old July 20th, 2005, 08:29 PM
Alan J. Flavell
Guest
 
Posts: n/a
Default Re: XHTML rendering on browser

On Tue, 27 Jul 2004, Alan J. Flavell wrote:
[color=blue]
> Or in technical terms, an "if-any-match" request to the origin server.[/color]

What *was* I thinking??? That should've been "if-none-match", of
course.
  #14  
Old July 20th, 2005, 08:29 PM
Brian
Guest
 
Posts: n/a
Default Re: XHTML rendering on browser

Alan J. Flavell wrote:[color=blue]
> On Tue, 27 Jul 2004, Alan J. Flavell wrote:
>[color=green]
>> in technical terms, an "if-any-match" request to the origin
>> server.[/color]
>
> What *was* I thinking??? That should've been "if-none-match", of
> course.[/color]

That explains it! I read that message a couple of times, and wasn't
sure how a if-any-match request would fit in. ;-)

--
Brian (remove ".invalid" to email me)
http://www.tsmchughs.com/
  #15  
Old July 20th, 2005, 08:29 PM
Alan J. Flavell
Guest
 
Posts: n/a
Default Re: XHTML rendering on browser

On Wed, 28 Jul 2004, Brian wrote:
[color=blue]
> Alan J. Flavell wrote:[color=green]
> > What *was* I thinking??? That should've been "if-none-match", of
> > course.[/color]
>
> That explains it![/color]

Somehow got my wires crossed with Apache's "satisfy any", but that's
something entirely different. I blame the fading grey cells...
 

Bookmarks

Thread Tools

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are Off
[IMG] code is Off
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are On

What is Bytes?

We are a network of experts and professionals in IT and software development that help one another with answers to tough questions and share insights. Get the best answers to your questions from over network members.
Post your question now . . .
It's fast and it's free

Popular Articles