javascript + cookies

M

Magnus

I have a iframe inside a main html file. The iframe is used to display
various html files. Inside the html files displayed in the iframe I want to
have javascript to set certain global cookies, which I can later access in
the main html file. Is this possible? It seems like when the cookies are set
inside the iframe, the cookies are not accessible in the main html file. I
have also tried using:

document.cookie = "path=/;var=val"

Also with no luck.

Anyone have a cure for this?

- Magnus
 
M

Moist

Magnus said:
I have a iframe inside a main html file. The iframe is used to display
various html files. Inside the html files displayed in the iframe I want to
have javascript to set certain global cookies, which I can later access in
the main html file. Is this possible? It seems like when the cookies are set
inside the iframe, the cookies are not accessible in the main html file. I
have also tried using:

document.cookie = "path=/;var=val"

Also with no luck.

Anyone have a cure for this?

- Magnus

One possible cure:
If, once you are done with the iframe, you go back to the main html, global
array or variables could be used instead to hold your data. If you quit the
browser then you can save in cookies at then main html level, this data can
be retrieve at the next invocation of your main html.

(even though I too would like to know how to access cookies globaly)
Moist
 
M

Magnus

Moist said:
One possible cure:
If, once you are done with the iframe, you go back to the main html, global
array or variables could be used instead to hold your data. If you quit the
browser then you can save in cookies at then main html level, this data can
be retrieve at the next invocation of your main html.

(even though I too would like to know how to access cookies globaly)
Moist

Simple solution that works for me is to use parent.document.cookie.

- Magnus
 

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,744
Messages
2,569,484
Members
44,903
Latest member
orderPeak8CBDGummies

Latest Threads

Top