Http code that precedes the html tags

Discussion in 'HTML' started by Judge Judy, Feb 4, 2009.

  1. Judge Judy

    Judge Judy Guest

    What does the http code before the <HTML> tag look like?

    I know that I can put cookies in the meta tags of the header block,
    however when I try to put it before the <HTML> tag it does not work.
    I don't understand what format the http code takes. There are
    riduculous long winded RFCs on just the HTTP version (who reads or
    writes this stuff), but none on how to send the HTTP to a browser.
     
    Judge Judy, Feb 4, 2009
    #1
    1. Advertising

  2. Judge Judy

    Gus Richter Guest

    Judge Judy wrote:
    > What does the http code before the <HTML> tag look like?
    >
    > I know that I can put cookies in the meta tags of the header block,
    > however when I try to put it before the <HTML> tag it does not work.
    > I don't understand what format the http code takes. There are
    > riduculous long winded RFCs on just the HTTP version (who reads or
    > writes this stuff), but none on how to send the HTTP to a browser.



    HTTP is the protocol used by the Browser (Client) requesting data to be
    transfered to it from a Server which then answers back and sends the
    data requested.

    <http://searchwindevelopment.techtarget.com/sDefinition/0,,sid8_gci214004,00.html>
    Hypertext Transfer Protocol:
    <http://en.wikipedia.org/wiki/Http>

    The Server sends the data to the Browser (Client) via packets using TCP/IP:
    <http://en.wikipedia.org/wiki/Internet_protocol_suite>

    The Data which the Server sends is the Web Page which you mention in
    your posting with the reference of <html>.

    HTML (HyperText Markup Language) in it's latest version is 4.01:
    <http://www.w3.org/TR/html4/>
    has specific rules for the structure of a W3C conforming HTML Document
    (Web Page), like so:

    There must be a Doctype Declaration.
    <html>
    <head>
    contains permittted HEAD elements
    </head>
    <body>
    contains permitted BODY elements
    </body>
    </html>

    The only thing permitted before the <html> tag is the Doctype
    Declaration, which normally should be this one:

    <!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01//EN"
    "http://www.w3.org/TR/html4/strict.dtd">

    If you place a META element (which is only permitted to be in the head
    section) outside of the head section as you say you did, then you should
    not be surprised that things don't work.

    You can only change HTTP within the browser software and/or within the
    server software and there is no reason whatsoever for you to want to do so.

    --
    Gus
     
    Gus Richter, Feb 4, 2009
    #2
    1. Advertising

  3. Judge Judy wrote:
    > What does the http code before the <HTML> tag look like?
    >
    > I know that I can put cookies in the meta tags of the header block,
    > however when I try to put it before the <HTML> tag it does not work.
    > I don't understand what format the http code takes. There are
    > riduculous long winded RFCs on just the HTTP version (who reads or
    > writes this stuff), but none on how to send the HTTP to a browser.


    You can't add HTTP headers by just inserting them in front of the HTML
    tag. In the HTTP response (as in many other types of Internet protocols,
    such as SMTP and NNTP), the headers are listed one after another, line
    by line, and then an empty line is inserted after them and before the
    body of the request. So once the client (the browser or whatever) has
    seen that blank line, it no longer expects to see headers, and treats
    everything after it as content.

    Headers are configured in the web server. If you are using a server-side
    programming technology, such as ASP, ASP.NET, or PHP, to generate your
    HTML, then there will be a method you can call (before any content has
    been sent to the client) to instruct the web server to add a desired
    header to that page.
     
    Harlan Messinger, Feb 4, 2009
    #3
  4. Judge Judy

    Lars Eighner Guest

    In our last episode, <>, the
    lovely and talented Judge Judy broadcast on alt.html:

    > What does the http code before the <HTML> tag look like?


    It doesn't matter because you cannot enter http headers in an html
    document. Http headers have to be sent by the server and by the
    time the first character of your html document is sent it is too late.

    You can get the server to send some kinds of headers based on .htaccess
    files --- when the server uses them. And when you --- if you --- generate
    documents dynamically with CGI or a server preprocessing module, you can
    indeed write headers for the server to pass on (and fortunately this is
    often made easy by appropriate functions or APIs). But there is nothing
    you can do in an html file.

    > I know that I can put cookies in the meta tags of the header block,
    > however when I try to put it before the <HTML> tag it does not work.


    Because META is an HTML element, and of course it cannot occur before the
    html starts (and for that matter, it has to be within the head element.

    > I don't understand what format the http code takes. There are
    > riduculous long winded RFCs on just the HTTP version (who reads or
    > writes this stuff), but none on how to send the HTTP to a browser.


    Oh, boo-hoo, you might have to spend some time in library. Well, I'll
    save you some trouble. You cannot do it in an html file. If CGI or
    a preprocessor is enabled on you server, you can generate HTTP headers,
    but you don't have to do endless research as most preprocessors will
    have appropriate functions to do the nitty-gritty for you and ditto for APIs
    for commonly used CGI languages.

    --
    Lars Eighner <http://larseighner.com/>
    13 days since Rick Warren prayed over Bush's third term.
    Obama: No hope, no change, more of the same. Yes, he can, but no, he won't.
     
    Lars Eighner, Feb 4, 2009
    #4
  5. Judge Judy

    Bergamot Guest

    Judge Judy wrote:
    >
    > I know that I can put cookies in the meta tags of the header block,


    You sound confused. What are you really trying to accomplish?

    --
    Berg
     
    Bergamot, Feb 4, 2009
    #5
  6. Judge Judy

    Judge Judy Guest

    On Wed, 04 Feb 2009 04:37:28 -0500, Gus Richter
    <> wrote:

    >Judge Judy wrote:
    >> What does the http code before the <HTML> tag look like?
    >>
    >> I know that I can put cookies in the meta tags of the header block,
    >> however when I try to put it before the <HTML> tag it does not work.
    >> I don't understand what format the http code takes. There are
    >> riduculous long winded RFCs on just the HTTP version (who reads or
    >> writes this stuff), but none on how to send the HTTP to a browser.

    >
    >
    >HTTP is the protocol used by the Browser (Client) requesting data to be
    >transfered to it from a Server which then answers back and sends the
    >data requested.
    >
    ><http://searchwindevelopment.techtarget.com/sDefinition/0,,sid8_gci214004,00.html>
    >Hypertext Transfer Protocol:
    > <http://en.wikipedia.org/wiki/Http>
    >
    >The Server sends the data to the Browser (Client) via packets using TCP/IP:
    > <http://en.wikipedia.org/wiki/Internet_protocol_suite>
    >
    >The Data which the Server sends is the Web Page which you mention in
    >your posting with the reference of <html>.
    >
    >HTML (HyperText Markup Language) in it's latest version is 4.01:
    > <http://www.w3.org/TR/html4/>
    >has specific rules for the structure of a W3C conforming HTML Document
    >(Web Page), like so:
    >
    > There must be a Doctype Declaration.
    > <html>
    > <head>
    > contains permittted HEAD elements
    > </head>
    > <body>
    > contains permitted BODY elements
    > </body>
    > </html>
    >
    >The only thing permitted before the <html> tag is the Doctype
    >Declaration, which normally should be this one:
    >
    > <!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01//EN"
    > "http://www.w3.org/TR/html4/strict.dtd">
    >
    >If you place a META element (which is only permitted to be in the head
    >section) outside of the head section as you say you did, then you should
    >not be surprised that things don't work.
    >
    >You can only change HTTP within the browser software and/or within the
    >server software and there is no reason whatsoever for you to want to do so.



    I think you misunderstood me. I followed the example on
    http://en.wikipedia.org/wiki/HTTP_cookie

    A server would set a cookie using the Http

    HTTP/1.1 200 OK <= I don't know if I need this ??
    Content-type: text/html
    Set-Cookie: name=value; ....


    I looked at other exampes and they did not include the
    "HTTP/1.1 ... " line.

    I tried with and without the HTTP line without sucess.



    ------------------------------------------------------------------------

    The HTML would put the cookie in the meta-tag

    <HTML>
    <head>
    <meta http-equiv=Set-Cookie: name=value; ...... >

    </head>

    etc

    I am able to generate a cookie from a static page, and I can create
    and manage cookies using a javascript. I think managing cookies on
    the client side cookies is very secure.
     
    Judge Judy, Feb 5, 2009
    #6
  7. Judge Judy wrote:
    > On Wed, 04 Feb 2009 04:37:28 -0500, Gus Richter
    > <> wrote:


    >> You can only change HTTP within the browser software and/or within the
    >> server software and there is no reason whatsoever for you to want to do so.

    >
    >
    > I think you misunderstood me. I followed the example on
    > http://en.wikipedia.org/wiki/HTTP_cookie
    >
    > A server would set a cookie using the Http
    >
    > HTTP/1.1 200 OK <= I don't know if I need this ??
    > Content-type: text/html
    > Set-Cookie: name=value; ....
    >


    This is what the webserver sends out in response to a request for your
    page. You do not put this in your markup.

    >
    > I looked at other exampes and they did not include the
    > "HTTP/1.1 ... " line.


    They do for HTTP transactions, it's part of the protocol.

    >
    > I tried with and without the HTTP line without sucess.


    How? In your markup?

    HTTP/1.1 200 OK
    <html>
    ....

    If so, of course if failed.

    > ------------------------------------------------------------------------
    >
    > The HTML would put the cookie in the meta-tag
    >
    > <HTML>
    > <head>
    > <meta http-equiv=Set-Cookie: name=value; ...... >
    >
    > </head>
    >
    > etc
    >
    > I am able to generate a cookie from a static page, and I can create
    > and manage cookies using a javascript. I think managing cookies on
    > the client side cookies is very secure.


    This again, if it is managed client-side is can also be changed and
    manipulated client-side, i.e., by the visitor not by you. Cookie
    security depends on what is in the cookie and how it is managed
    server-side. Putting sensitive information: passwords, account #, SSN,
    etc. in cookies is a *very, very, very bad* idea. *Never* should be done.

    --
    Take care,

    Jonathan
    -------------------
    LITTLE WORKS STUDIO
    http://www.LittleWorksStudio.com
     
    Jonathan N. Little, Feb 5, 2009
    #7
  8. Judge Judy

    richard Guest

    On Wed, 04 Feb 2009 05:50:32 GMT, Judge Judy <> wrote:

    >What does the http code before the <HTML> tag look like?
    >
    >I know that I can put cookies in the meta tags of the header block,
    >however when I try to put it before the <HTML> tag it does not work.
    >I don't understand what format the http code takes. There are
    >riduculous long winded RFCs on just the HTTP version (who reads or
    >writes this stuff), but none on how to send the HTTP to a browser.


    <!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN"
    "http://www.w3.org/TR/html4/loose.dtd">

    It's not http or html. It is a page style declaration which helps
    determine how the page is to be handled.

    where you see 4.01 transitional can also be other types of page styles
    such as strict.

    www.w3.org
     
    richard, Feb 6, 2009
    #8
  9. Judge Judy

    richard Guest

    On Wed, 04 Feb 2009 08:22:52 -0600, Bergamot <>
    wrote:

    >
    >Judge Judy wrote:
    >>
    >> I know that I can put cookies in the meta tags of the header block,

    >
    >You sound confused. What are you really trying to accomplish?



    Well duhh. What is the one line of code that precedes the <html> tag?
    doctype don't mean nuthin?
     
    richard, Feb 6, 2009
    #9
  10. Judge Judy

    rf Guest

    richard wrote:
    > On Wed, 04 Feb 2009 08:22:52 -0600, Bergamot <>
    > wrote:
    >
    >>
    >> Judge Judy wrote:
    >>>
    >>> I know that I can put cookies in the meta tags of the header block,

    >>
    >> You sound confused. What are you really trying to accomplish?

    >
    >
    > Well duhh. What is the one line of code that precedes the <html> tag?
    > doctype don't mean nuthin?


    Before the <html> tag there may be a doctype.

    Before that (or the <html> tag) there is a single empty line.

    Before that are the HTTP headers.

    Well duh. That is what the OP is talking about. The HTTP headers. That is
    why she said "What does the http code before the <HTML> tag look like?."
     
    rf, Feb 6, 2009
    #10
  11. Judge Judy

    Gus Richter Guest

    Judge Judy wrote:
    > On Wed, 04 Feb 2009 04:37:28 -0500, Gus Richter
    > <> wrote:
    >
    >> Judge Judy wrote:
    >>> What does the http code before the <HTML> tag look like?
    >>>
    >>> I know that I can put cookies in the meta tags of the header block,
    >>> however when I try to put it before the <HTML> tag it does not work.
    >>> I don't understand what format the http code takes. There are
    >>> riduculous long winded RFCs on just the HTTP version (who reads or
    >>> writes this stuff), but none on how to send the HTTP to a browser.

    >>
    >> HTTP is the protocol used by the Browser (Client) requesting data to be
    >> transfered to it from a Server which then answers back and sends the
    >> data requested.
    >>
    >> <http://searchwindevelopment.techtarget.com/sDefinition/0,,sid8_gci214004,00.html>
    >> Hypertext Transfer Protocol:
    >> <http://en.wikipedia.org/wiki/Http>
    >>
    >> The Server sends the data to the Browser (Client) via packets using TCP/IP:
    >> <http://en.wikipedia.org/wiki/Internet_protocol_suite>
    >>
    >> The Data which the Server sends is the Web Page which you mention in
    >> your posting with the reference of <html>.
    >>
    >> HTML (HyperText Markup Language) in it's latest version is 4.01:
    >> <http://www.w3.org/TR/html4/>
    >> has specific rules for the structure of a W3C conforming HTML Document
    >> (Web Page), like so:
    >>
    >> There must be a Doctype Declaration.
    >> <html>
    >> <head>
    >> contains permittted HEAD elements
    >> </head>
    >> <body>
    >> contains permitted BODY elements
    >> </body>
    >> </html>
    >>
    >> The only thing permitted before the <html> tag is the Doctype
    >> Declaration, which normally should be this one:
    >>
    >> <!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01//EN"
    >> "http://www.w3.org/TR/html4/strict.dtd">
    >>
    >> If you place a META element (which is only permitted to be in the head
    >> section) outside of the head section as you say you did, then you should
    >> not be surprised that things don't work.
    >>
    >> You can only change HTTP within the browser software and/or within the
    >> server software and there is no reason whatsoever for you to want to do so.

    >
    >
    > I think you misunderstood me. I followed the example on
    > http://en.wikipedia.org/wiki/HTTP_cookie
    >
    > A server would set a cookie using the Http
    >
    > HTTP/1.1 200 OK <= I don't know if I need this ??
    > Content-type: text/html
    > Set-Cookie: name=value; ....
    >
    >
    > I looked at other exampes and they did not include the
    > "HTTP/1.1 ... " line.
    >
    > I tried with and without the HTTP line without sucess.



    I believe that it is you that did not understand me. The html document
    structure is (should be) as I said. The http header exchange between
    browser/server is in the background which you have no access to
    directly. When you introduce a cookie via meta (as in your example
    below) or script (browser-side or server-side), it is added to the http
    header automatically - you do not access the http header directly, as I
    understood you to say.


    > ------------------------------------------------------------------------
    >
    > The HTML would put the cookie in the meta-tag
    >
    > <HTML>
    > <head>
    > <meta http-equiv=Set-Cookie: name=value; ...... >
    >
    > </head>
    >
    > etc
    >
    > I am able to generate a cookie from a static page, and I can create
    > and manage cookies using a javascript. I think managing cookies on
    > the client side cookies is very secure.



    Search using cookies and security as keywords and do a bit of reading.

    --
    Gus
     
    Gus Richter, Feb 6, 2009
    #11
  12. Judge Judy

    dorayme Guest

    In article <HfSil.17860$>,
    "rf" <> wrote:

    > Before the <html> tag there may be a doctype.
    >
    > Before that (or the <html> tag) there is a single empty line.


    Can you say more about the need for the single empty line before a dd?
    Is this something the server adds somehow or something that one should
    have in ones html docs before loading up to a server? Is there some fine
    point here that I need to know about?

    --
    dorayme
     
    dorayme, Feb 6, 2009
    #12
  13. Judge Judy

    rf Guest

    dorayme wrote:
    > In article <HfSil.17860$>,
    > "rf" <> wrote:
    >
    >> Before the <html> tag there may be a doctype.
    >>
    >> Before that (or the <html> tag) there is a single empty line.

    >
    > Can you say more about the need for the single empty line before a dd?
    > Is this something the server adds somehow or something that one should
    > have in ones html docs before loading up to a server? Is there some
    > fine point here that I need to know about?


    It's nothing you need to worry about. It's to seperate the HTTP response
    headers from the response body (the bit you know of as an HTML page). The
    headers have to go in the TCP/IP message somewhere. They go at the front of
    the message, followed by a empty line, followed by your HTML.

    The headers are usually put there by the HTTP server. You can, however,
    cause different headers to be sent using, for example, PHP. Once again
    though you don't need to worry about where those headers are.

    Here is a picture of a HTTP request made using telnet:

    http://en.wikipedia.org/wiki/File:Http_request_telnet_ubuntu.png

    You can also look at the headers using firebug, the net tab, expand the GET.
    Firebug helpfully seperates the headers from the response body (remember the
    empty line delimiter) and presents them in two seperate tabs.

    Similar stuff happens with email and usenet. Cause your newsreader to
    display a raw NTTP message. You will see the NTTP headers, an empty line and
    then the actual message.
     
    rf, Feb 6, 2009
    #13
  14. Judge Judy

    dorayme Guest

    In article <HK1jl.17962$>,
    "rf" <> wrote:

    > dorayme wrote:
    > > In article <HfSil.17860$>,
    > > "rf" <> wrote:
    > >
    > >> Before the <html> tag there may be a doctype.
    > >>
    > >> Before that (or the <html> tag) there is a single empty line.

    > >
    > > Can you say more about the need for the single empty line before a dd?
    > > Is this something the server adds somehow or something that one should
    > > have in ones html docs before loading up to a server? Is there some
    > > fine point here that I need to know about?

    >
    > ...It's to seperate the HTTP response
    > headers from the response body (the bit you know of as an HTML page). The
    > headers have to go in the TCP/IP message somewhere. They go at the front of
    > the message, followed by a empty line, followed by your HTML.


    Righto. I see.

    --
    dorayme
     
    dorayme, Feb 7, 2009
    #14
    1. Advertising

Want to reply to this thread or ask your own question?

It takes just 2 minutes to sign up (and it's free!). Just click the sign up button to choose a username and then you can ask your own questions on the forum.
Similar Threads
  1. Dean H. Saxe
    Replies:
    0
    Views:
    1,052
    Dean H. Saxe
    Jan 3, 2004
  2. Rob Nicholson
    Replies:
    3
    Views:
    771
    Rob Nicholson
    May 28, 2005
  3. Ranganath

    Custom Tags within Custom Tags.

    Ranganath, Oct 17, 2003, in forum: Java
    Replies:
    2
    Views:
    470
    Ranganath
    Oct 21, 2003
  4. Mike
    Replies:
    3
    Views:
    889
    Michael Borgwardt
    Jan 9, 2004
  5. Donald Firesmith

    html tags within meta tags allowed?

    Donald Firesmith, Jan 5, 2005, in forum: XML
    Replies:
    5
    Views:
    917
    Andy Dingley
    Jan 8, 2005
Loading...

Share This Page