making kareha use application/xhtml+xml instead of text/html (21)

1 Name: hotaru!hoTarufiRE!!H0csnvz2 2005-01-28 16:08 ID:NT2gqBuB (Replies) [Del]

why you should do it

  • application/xhtml+xml is the correct content-type for xhtml.
  • internet explorer doesn't know what to do with application/xhtml+xml
  • 100webspace doesn't put their stupid banners in application/xhtml+xml documents

how to do it
replace &thread= with &thread=
replace text/html with application/xhtml+xml
replace document.threadform with document.forms.threadform
replace text/html with application/xhtml+xml

replace document.threadform with document.forms.threadform
replace nodeName=="A" with nodeName.toLowerCase()=="a"

add AddType application/xhtml+xml html

2 Name: !WAHa.06x36 2005-01-28 17:00 ID:pMbmbK+g (Replies) [Del]

The first is already done. For the second, I was thinking of using that hack you cooked up in PerlHP to send application/xhtml+xml to browsers that support it. I'd like to figure out how to make Apache do that too, though. Got any ideas?

3 Name: !WAHa.06x36 2005-01-28 18:07 ID:pMbmbK+g (Replies) [Del]

Hmm, a problem is that the filetype is hardcoded in the HTML file itself, and there's really no way to make that intellgently select the right kind of file. However, I think browsers generally ignore the filetype given in the HTML, because they've already have to have decided that the file is HTML before they can even see it. So maybe I could hardcode that as application/xhtml+xml...

4 Name: hotaru!hoTarufiRE!!H0csnvz2 2005-01-29 00:17 ID:5aO8rO5h (Replies) [Del]

you could make the script write out PerlHP or php files instead of normal html files... all you'd have to change is GLOBAL_HEAD_INCLUDE in and HTML_SELF, HTML_BACKLOG, and PAGE_EXT in

all 19 browsers that i have on this machine ignore the type given in the html file itself, so you could probably hardcode it as whatever you want without anyone noticing...

5 Name: hotaru!hoTarufiRE!!H0csnvz2 2005-01-29 02:10 ID:5aO8rO5h (Replies) [Del]

also, <nobr> does not work in xhtml...

6 Name: !WAHa.06x36 2005-01-29 07:11 ID:pMbmbK+g (Replies) [Del]

Writing out dynamic pages is a bit too ineffecient. I'm sure you can use if statements and stuff in the Apache config to get the same effect, I just don't know how.

Does the browser complain outright about <nobr>, or just ignore it? Because I can easily put in the correct styles in addition to the <nobr>, it's really just there to make IE behave.

7 Name: !WAHa.06x36 2005-01-29 09:24 ID:mxlstqVw (Replies) [Del]

Ah, this appears to do the trick:

<IfModule mod_rewrite.c>
RewriteEngine On
RewriteCond %{HTTP_ACCEPT} application/xhtml\+xml
RewriteRule \.html$ - [T=application/xhtml+xml]

8 Name: Anonymous 2005-01-29 13:46 ID:7pTQ9y2+ (Replies) [Del]

the firefox displays an error page that says "not well formed"... the w3c validator shows <nobr> as being the only problem, and removing it makes the error go away in firefox....

that only works if you have mod_rewrite, and 100webspace apparently doesn't...

9 Name: !WAHa.06x36 2005-01-29 14:33 ID:mxlstqVw (Replies) [Del]

It works fine for me with <nobr> left in, actually. I did find a typo though that was causing problems ("cibst" instead of "const"), but I'm not sure if that's in any released version.

10 Name: !WAHa.06x36 2005-01-29 14:47 ID:mxlstqVw (Replies) [Del]

Ok, I essentially have this working now. The thread views that go through the script sniff HTTP_ACCEPT to figure out if they can send application/xhtml+xml, I applied your fixes to make the code properly compliant, but I could leave in <nobr> without problems. Also, I'm putting the HTTP_ACCEPT sniffing code into example.htaccess. If the server doesn't have mod_rewrite, I'd definitely suggest sending text/html instead, but if you want, you can send application/xhtml+xml and break IE.

11 Name: hotaru!hoTarufiRE!!H0csnvz2 2005-01-29 21:12 ID:C6GtE3/N (Replies) [Del]

> break IE

IE is already broken.

12 Name: Anonymous 2005-01-30 02:10 ID:Heaven (Replies) [Del]

Indeed. Only cater to it if it doesn't affect anything else.

13 Name: !WAHa.06x36 2005-02-23 19:39 ID:OTuC5WVv (Replies) [Del]

> replace document.threadform with document.forms.threadform

Actually, I've found out this isn't correct, either. document.forms is supposedly not valid in strict XHTML mode. Firefox supports it to some point, but it is sort of broken. I ended up changing all <form name= into <form id=, and used document.getElementsById() instead. I should have done so from the start, I suppose, since it is The Way.

14 Name: coda 2005-02-26 20:30 ID:TYcvLn0p [Del]

you can add a key to mime types in your registry for the application/xhtml+xml type, and IE will figure it out without any server-side intervention.

Key: HKCR\Mime\Database\Content Type\application/xhtml+xml
CLSID: {25336920-03F9-11cf-8FD0-00AA00686F13}
Encoding: 0x8000000
Extension: .xhtm

{25336920-03F9-11cf-8FD0-00AA00686F13} is mshtml.dll

15 Name: hotaru!hoTarufiRE!!H0csnvz2 2005-02-27 00:22 ID:ST2WQPCd [Del]

>CLSID: {48123bc4-99d9-11d1-a6b3-00c04fd91555}

{48123bc4-99d9-11d1-a6b3-00c04fd91555} is msxml3.dll

16 Name: coda 2005-02-28 09:34 ID:6wt+ZMDY [Del]

doesn't that make it display as raw XML? i haven't tried it

17 Name: hotaru!hoTarufiRE!!H0csnvz2 2005-02-28 21:24 ID:2bK8ECXM [Del]

yes. making it display it as raw xml is more correct than making it parse it as html.

18 Name: coda 2005-02-28 21:39 ID:TYcvLn0p [Del]

<font color=red><b>:(</font></b>
bad html for life!

19 Name: Anonymous 2005-03-16 02:21 ID:Heaven [Del]

why you shouldn't use forced XHTML/XML

  • Message boards allow for users to add characters that break XML
  • It takes only 1 error to render a page non-usable
  • As much as IE is bad, refusing to support the majority browser without modification is one way to loose visitors.

20 Name: !WAHa.06x36 2005-03-16 10:20 ID:Heaven [Del]

> Message boards allow for users to add characters that break XML

Untrue. Only admins can add characters that break XML, and then only by editing the config files. If there is a way for users to do this, report it as a bug.

> It takes only 1 error to render a page non-usable

Both a blessing and a curse - this makes it easier to find errors which would make a simpler browser break if it was served to it. For instance, mobile phones. Essentially, it forces the programmer and admin to get their acts together.

> As much as IE is bad, refusing to support the majority browser without modification is one way to loose visitors.

Kareha checks if the browser supports application/xhtml+xml before sending it. IE is thus unaffected, and gets served text/html.

21 Name: !WAHa.06x36 2005-03-16 10:21 ID:oWhB6st1 [Del]

I meant to bump this, really.

Name: Link:
Leave these fields empty (spam trap):
More options...