[thelist] Javascript newbie - errors
Kristof Neirynck
k.neirynck at belgacom.net
Sun Oct 26 04:07:20 CST 2003
Jeff Howden wrote:
>><><><><><><><><><><><><><><><><><><><><><><><><><><><><><
>>2. Send your page as "application/xhtml+xml" for the
>> browsers that support it.
>><><><><><><><><><><><><><><><><><><><><><><><><><><><><><
>
> requires server-side knowledge and user-agent sniffing which is, itself,
> error-prone. another bad idea.
You should know better than to think I would drive anyone into
user-agent sniffing.
There is such a thing as the HTTP_ACCEPT-header.
if (stristr($_SERVER[HTTP_ACCEPT], "application/xhtml+xml"))
header("Content-Type: application/xhtml+xml; charset=iso-8859-1");
<http://www.juicystudio.com/tutorial/xhtml/mime.asp>
> that's understandable, but it makes the use of imported stylesheets alittle
> cumbersome. for example, suppose you have an imported stylesheet that needs
> to be defined *after* another stylesheet. you can either place the @import
No browser will ever object against this.
<link href="main.css" rel="stylesheet" type="text/css" />
<link href="standard.css" rel="stylesheet" type="text/css"
title="Standard" />
>><><><><><><><><><><><><><><><><><><><><><><><><><><><><><
>>3. Change your doctype to XHTML 1.0 and keep sending it
>> as text/html.
>><><><><><><><><><><><><><><><><><><><><><><><><><><><><><
>
> sounds by far the best solution of the lot.
Personally I'd go with HTML 4.01 strict.
I'm lazy.
> speaking of comments within <style> and <script> blocks, is there a place
> online that does a definitive breakdown of when to use and not to use
> comments, what kind (regular html vs w/ cdata notations), etc.?
There is one in your mailbox right now.
<!--
This is comment.
And it is very useful for those freaky wormblooded bopods that we are.
Computers wisely ignore this.
-->
<![CDATA[
This is NOT comment.
Unescaped charachters go here.
^$*ùµ~âè
Computers must read this.
]]>
Comments behave predictably in any browser, CDATAs do not.
CSS and JS don't belong in your html, put them in a separate file.
It will save you a lot of trouble.
If you must have css and/or js in your html, don't comment em out.
I've never seen a browser object to that.
Kristof
More information about the thelist
mailing list