Forum Moderators: open

Message Too Old, No Replies

Comments in HTML Headers? (not within the head tags)

         

JAB Creations

11:30 am on Aug 15, 2005 (gmt 0)

WebmasterWorld Senior Member 10+ Year Member



I was wondering if it's possible to insert comments in to the header of a document?

encyclo

12:10 pm on Aug 15, 2005 (gmt 0)

WebmasterWorld Senior Member 10+ Year Member



Normal
<!-- comment -->
comments? Yes, there is no problem. You should avoid putting a comment before the doctype, however, as this will put IE6 into quirks mode.

JAB Creations

1:09 pm on Aug 16, 2005 (gmt 0)

WebmasterWorld Senior Member 10+ Year Member



I know I was unclear on this...no in the header as in when you send a HEAD request in place of a GET request to a server. I know about IE/Quirks...I have an XML declaration on all of my pages. :-D

encyclo

1:21 pm on Aug 16, 2005 (gmt 0)

WebmasterWorld Senior Member 10+ Year Member



OK, you mean in the HTTP header? In that case, yes, you can add arbitrary HTTP headers - I believe the convention is to start non-standard headers with
X-
.

Try this with PHP (before any content, obviously):

<?php header("X-foobar: I love widgets!"); ?>

JAB Creations

1:48 pm on Aug 16, 2005 (gmt 0)

WebmasterWorld Senior Member 10+ Year Member



Nice! It worked...but the view I used is kinda scruffy...have something you'd personally suggest? Thanks!