Google Groups no longer supports new Usenet posts or subscriptions. Historical content remains viewable.
Dismiss

Applet and Cookie/JavaScript IE hell..... Help please?

13 views
Skip to first unread message

crg

unread,
Oct 6, 2000, 3:00:00 AM10/6/00
to
Hi

I am trying to set and get cookies from an applet I have written.
After much trawling of the newsgroup archives and the net the only two
methods
I found that suggest this can be done both use the JSObject class.

This seems to work fine for me with Netscape 4x but I am having huuuge
problems
trying to get it to work under IE5x.

If I use the much posted suggestion:

JSObject window = JSObject.getWindow(applet);
JSObject document = (JSObject )window.getMember( "document" );
blah....

I get the following exception when attempting the getWindow call.

netscape.javascript.JSException
at netscape.javascript.JSObject.getWindow(Unknown Source)
at com.bt.chart.applet.Cookie.<init>(Cookie.java:31)
at com.bt.chart.applet.ChartApplet.start(ChartApplet.java:76)
at sun.applet.AppletPanel.run(Unknown Source)
at java.lang.Thread.run(Unknown Source)

If I use the method of trying to communicate with the page the applet is on
and one of its JSCript functions
i.e

this.getAppletContext().showDocument
(new URL("javascript:setCookie(\"fred=hello\")"));

I get the following exception

java.net.MalformedURLException: unknown protocol: javascript
at java.net.URL.<init>(Unknown Source)
at java.net.URL.<init>(Unknown Source)
at java.net.URL.<init>(Unknown Source)
at com.bt.chart.applet.ChartApplet.start(ChartApplet.java:79)
at sun.applet.AppletPanel.run(Unknown Source)
at java.lang.Thread.run(Unknown Source)


Does nayone have any idea what I am doing wrong for IE?

Moons of kudos if you can help me,
Many thanks
C

crg

unread,
Oct 6, 2000, 3:00:00 AM10/6/00
to
After much more searching (whew exhausted) the URL

http://java.sun.com/products/plugin/1.3/docs/jsobject.html

gave the correct MAYSCRIPT syntax to use in the applet call in the HTML page
and some more useful information about applets and the JSObject.
Still doesnt set the cookie in IE yet though.........

"crg" <GOUL...@btuk02.bt.com> wrote in message
news:8rkeag$kq9$1...@pheidippides.axion.bt.co.uk...

0 new messages