Velocity Reviews - Computer Hardware Reviews

Velocity Reviews > Newsgroups > Programming > HTML > Http code that precedes the html tags

Reply
Thread Tools

Http code that precedes the html tags

 
 
Judge Judy
Guest
Posts: n/a
 
      02-04-2009
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.
 
Reply With Quote
 
 
 
 
Gus Richter
Guest
Posts: n/a
 
      02-04-2009
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
 
Reply With Quote
 
 
 
 
Harlan Messinger
Guest
Posts: n/a
 
      02-04-2009
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.
 
Reply With Quote
 
Lars Eighner
Guest
Posts: n/a
 
      02-04-2009
In our last episode, <(E-Mail Removed)>, 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/> http://www.velocityreviews.com/forums/(E-Mail Removed)
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.
 
Reply With Quote
 
Bergamot
Guest
Posts: n/a
 
      02-04-2009

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
 
Reply With Quote
 
Judge Judy
Guest
Posts: n/a
 
      02-05-2009
On Wed, 04 Feb 2009 04:37:28 -0500, Gus Richter
<(E-Mail Removed)> 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.
 
Reply With Quote
 
Jonathan N. Little
Guest
Posts: n/a
 
      02-05-2009
Judge Judy wrote:
> On Wed, 04 Feb 2009 04:37:28 -0500, Gus Richter
> <(E-Mail Removed)> 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
 
Reply With Quote
 
richard
Guest
Posts: n/a
 
      02-06-2009
On Wed, 04 Feb 2009 05:50:32 GMT, Judge Judy <(E-Mail Removed)> 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


 
Reply With Quote
 
richard
Guest
Posts: n/a
 
      02-06-2009
On Wed, 04 Feb 2009 08:22:52 -0600, Bergamot <(E-Mail Removed)>
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?
 
Reply With Quote
 
rf
Guest
Posts: n/a
 
      02-06-2009
richard wrote:
> On Wed, 04 Feb 2009 08:22:52 -0600, Bergamot <(E-Mail Removed)>
> 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?."


 
Reply With Quote
 
 
 
Reply

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 On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are Off


Similar Threads
Thread Thread Starter Forum Replies Last Post
problem in running a basic code in python 3.3.0 that includes HTML file Satabdi Mukherjee Python 1 04-04-2013 07:48 PM
HTTP SOAP/HTTP GET/HTTP POST milan_9211 Software 0 01-10-2011 02:10 PM
All style tags after the first 30 style tags on an HTML page are not applied in Internet Explorer Rob Nicholson ASP .Net 3 05-28-2005 03:11 PM
html tags within meta tags allowed? Donald Firesmith XML 5 01-08-2005 11:29 PM
RegEx to find CFML tags nested in HTML tags Dean H. Saxe Perl 0 01-03-2004 06:11 PM



Advertisments