473,471 Members | 1,967 Online
Bytes | Software Development & Data Engineering Community
Create Post

Home Posts Topics Members FAQ

javascript + cookies

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
Jul 23 '05 #1
3 1826

"Magnus" <no@spam.com> a écrit dans le message de
news:41********@news.broadpark.no...
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
Jul 23 '05 #2
You may need to set the DOMAIN attribute of the cookie.

Magnus wrote:
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


Jul 23 '05 #3

"Moist" <mo***@msn.com> skrev i melding
news:VX******************@weber.videotron.net...

"Magnus" <no@spam.com> a écrit dans le message de
news:41********@news.broadpark.no...
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


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

- Magnus
Jul 23 '05 #4

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

0
by: Gowhera Hussain | last post by:
Use This for Learning Only .... Do Not Try To Act Smart HACKING WITH JAVASCRIPT Dr_aMado Sun, 11 Apr 2004 16:40:13 UTC This tutorial is an overview of how javascript can be used to bypass...
2
by: Michael | last post by:
I am reading and setting a cookie using JavaScript in the BODY onload and onunload events respectively. This works fine. However when I use ASP to set the cookie under some condition where I...
1
by: John Taylor-Johnston | last post by:
I'm a University academic looking for a proper definition of JavaScript Cookies. http://www.CollegeSherbrooke.qc.ca/languesmodernes/604-HAE_Grammar_Practice/ I'm trying to decipher what...
9
by: SHarris | last post by:
Hello, In our new intranet ASP.NET project, two requirements are that the browser accept cookies AND JavaScript. We are requiring the use of Internet Explorer 6+. 1. Using C# in an ASP.NET...
2
by: HopfZ | last post by:
Server sends cookie to browser and the browser send the same cookie back to the server according to Wikipedia. Do browsers send even javascript-generated cookie to servers? For example, if I...
0
by: Hystou | last post by:
There are some requirements for setting up RAID: 1. The motherboard and BIOS support RAID configuration. 2. The motherboard has 2 or more available SATA protocol SSD/HDD slots (including MSATA, M.2...
0
marktang
by: marktang | last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However,...
1
by: Hystou | last post by:
Overview: Windows 11 and 10 have less user interface control over operating system update behaviour than previous versions of Windows. In Windows 11 and 10, there is no way to turn off the Windows...
0
tracyyun
by: tracyyun | last post by:
Dear forum friends, With the development of smart home technology, a variety of wireless communication protocols have appeared on the market, such as Zigbee, Z-Wave, Wi-Fi, Bluetooth, etc. Each...
0
agi2029
by: agi2029 | last post by:
Let's talk about the concept of autonomous AI software engineers and no-code agents. These AIs are designed to manage the entire lifecycle of a software development project—planning, coding, testing,...
1
isladogs
by: isladogs | last post by:
The next Access Europe User Group meeting will be on Wednesday 1 May 2024 starting at 18:00 UK time (6PM UTC+1) and finishing by 19:30 (7.30PM). In this session, we are pleased to welcome a new...
0
by: TSSRALBI | last post by:
Hello I'm a network technician in training and I need your help. I am currently learning how to create and manage the different types of VPNs and I have a question about LAN-to-LAN VPNs. The...
0
by: adsilva | last post by:
A Windows Forms form does not have the event Unload, like VB6. What one acts like?
0
muto222
php
by: muto222 | last post by:
How can i add a mobile payment intergratation into php mysql website.

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.