read and write a cookie from an applet

M

Marco

It is possible read or write a cookie from an applet?

I need only set the value of a variable setted from user from remember it in
next use, as setCookie(String name, string value).

The cookie must be set client size, by the site of the applet or by local,
without request to a server (only applet knows name and value, and server,
perhaps, don't exists or don't support serverside pages).

I can use javascript, if it is possible, javascript function with
document.cookie, but I don't know a way (I tryed netscape.javascript, but it
don' work on my PC, and I need a general (portable) solution.

Thank you

Marco

N.B. For the first, can I pass to applet the value that a javascript reads
by haml tags?
 
C

Chris Smith

Marco said:
I can use javascript, if it is possible, javascript function with
document.cookie, but I don't know a way (I tryed netscape.javascript, but it
don' work on my PC, and I need a general (portable) solution.

That's the first thing that comes to mind. You can't get LiveConnect
working on your computer?

The other long-shot if you've got control over the server (and I'm not
sure if this would work or not) would be to AppletContext.showDocument a
URL that convinces the server to send the cookie you want within the
same domain.

--
www.designacourse.com
The Easiest Way To Train Anyone... Anywhere.

Chris Smith - Lead Software Developer/Technical Trainer
MindIQ Corporation
 
A

Andrew Thompson

Roedy said:
that page does not mention the word LiveConnect even once. To me
LiveConnect is the Symantec utility to fetch program updates. To you
it is?

LiveConnect allows applet to interact with JavaScript,
to call JS methods.

It is a little hard to get up and running with,
<from vague memory>
...but I found I could connect a cut-down version of the liveconnect
classes jar (at around 6Kb) that allowed an applet to invoke
JS methods available to the web page.
AFAIR I needed to reference the classes for compilation, but
found they were already available to the browser VM.
</from vague memory>

It is most handy.

I am not sure of the exact origin of the name 'LiveConnect',
but it does refer/connect to the netscape.javascript package
classes mentioned in the page.
 
R

Real Gagnon

R

Real Gagnon

..but I found I could connect a cut-down version of the liveconnect
classes jar (at around 6Kb) that allowed an applet to invoke
JS methods available to the web page.
AFAIR I needed to reference the classes for compilation, but
found they were already available to the browser VM.
</from vague memory>

The netscape.javascript.* package is now included in %JRE_HOME%\lib
\jaws.jar file. So to compile, you need to include it in your classpath.

Bye.
 
M

Marco

The other long-shot if you've got control over the server (and I'm not
sure if this would work or not) would be to AppletContext.showDocument a
URL that convinces the server to send the cookie you want within the
same domain.

I always use this; it work.

Thank you
 

Ask a Question

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

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Members online

No members online now.

Forum statistics

Threads
473,999
Messages
2,570,243
Members
46,836
Latest member
login dogas

Latest Threads

Top