Page 1 of 1

HTML Cookies

Posted: Fri Aug 07, 2009 2:26 pm
by ConvertFromOldNGs
by Stephen Persson >> Fri, 23 Jun 2000 1:36:10 GMT

How can you read a cookie from within a web app?

The Jade web site is now doing it - where they write your web session ID to a cookie so you can move between static html pages & the Jade generated pages freely.

I can get Jade to write the cookies OK, and I can read these values using a Java script on other static pages, but I can't see how I can get the app to read back values I have already written to the cookie.

Any clues? (or an abundance of free source code would also suffice!)

Re: HTML Cookies

Posted: Fri Aug 07, 2009 2:26 pm
by ConvertFromOldNGs
by Robert Barr >> Fri, 23 Jun 2000 3:26:19 GMT
How can you read a cookie from within a web app?

Try the following:

cookies := pipe.getServerVariable('HTTP_COOKIE');

The getServerVariable() method is described in another posting
(NamedPipe Asynch example). All that remains is to parse the cookies string.

Good luck,
Rob

Re: HTML Cookies

Posted: Fri Aug 07, 2009 2:26 pm
by ConvertFromOldNGs
by Wilfred Verkley >> Mon, 26 Jun 2000 3:32:30 GMT

But is there anyway to *set* a cookie in the standard Jade Web architecture?

I know of a hack to manually set the HTML returned, but no way to add a "Set-Cookie" command to the HTTP response.

How is http://www.jade.co.nz doing it?

Re: HTML Cookies

Posted: Fri Aug 07, 2009 2:27 pm
by ConvertFromOldNGs
by peter fitchett >> Wed, 28 Jun 2000 2:46:19 GMT

Most sites set cookies by specifying javascript functions in the <head>..</head> part of the page and then calling that from within the body with the cookie parameter. There is nothing that requires the functions to be specified in the html head - you can just put all the (tailored) code within the page body - and a JADE Html control is sufficient to allow you to do that, isn't it?

Re: HTML Cookies

Posted: Fri Aug 07, 2009 2:27 pm
by ConvertFromOldNGs
by Wilfred Verkley >> Wed, 28 Jun 2000 3:16:29 GMT
Most sites set cookies by specifying javascript functions in the <head>..</head> part of the page and then calling that from within the body with the cookie parameter.

Thats a good work-around, thanks.

Most code ive seen sets the cookie using an command in the HTTP header of the response, not using a client-side script, which requires JavaScript to be enabled and supported by the browser.

This is a big issue. It would be nice if we could return XML or other data types (like WML for WAP apps) from within jade using the standard web architecture (instead of having to design work-arounds). However, we have no control over the "Content-Type" header or any other part of the HTTP header, which limits Jade a lot.

BTW, is anyone entering the Nokia "Best of WAP" contest? Using Jade?

Re: HTML Cookies

Posted: Fri Aug 07, 2009 2:27 pm
by ConvertFromOldNGs
by Carl Ranson >> Wed, 28 Jun 2000 21:12:36 GMT
This is a big issue. It would be nice if we could return XML or other data types (like WML for WAP apps) from within jade using the standard web architecture (instead of having to design work-arounds). However, we have no control over the "Content-Type" header or any other part of the HTTP header, which limits Jade a lot.

Actually this can be done with a little work.

Just don't expect to be able to send a binary stream back as JadeHttp.dll can't hack it. :)

CR

Re: HTML Cookies

Posted: Fri Aug 07, 2009 2:27 pm
by ConvertFromOldNGs
by JADE Kid - Ray Hidayat >> Tue, 4 Jul 2000 21:31:13 GMT

The JADE site is made in JADE, but it borrows a bit from here and there, so maybe the cookie method is not written in JADE

--
Ray Hidayat
JADE Kid - 2000
www.jadekids.com