473,378 Members | 1,377 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,378 software developers and data experts.

Accessing IFRAME content question

Hi all,

I have a page with an IFRAME in it. From a script in the main ( parent )
page I instruct the IFRAME to load a specific URL. The URL contains
parameters that are processed by the server. The server then writes a result
cookie into the content destined for the IFRAME.

I am having issues accessing the cookie. If I use a debuger I can see the
cookie via a quickwatch looking at window.frames['name].document.cookie
however when I run the code the same variable is empty. Does anyone have any
ideas??

Many thanks for your responses//

Paul
Jul 23 '05 #1
4 4943
Paul Brant wrote:
Hi all,

I have a page with an IFRAME in it. From a script in the main ( parent )
page I instruct the IFRAME to load a specific URL. The URL contains
parameters that are processed by the server. The server then writes a
result cookie into the content destined for the IFRAME.

I am having issues accessing the cookie. If I use a debuger I can see the
cookie via a quickwatch looking at window.frames['name].document.cookie
however when I run the code the same variable is empty. Does anyone have
any ideas??

Many thanks for your responses//

Paul


Hi

Is the URL in the IFRAME on the same domain as the mainpage?

Regards,
Erwin Moller
Jul 23 '05 #2


Paul Brant wrote:

I have a page with an IFRAME in it. From a script in the main ( parent )
page I instruct the IFRAME to load a specific URL. The URL contains
parameters that are processed by the server. The server then writes a result
cookie into the content destined for the IFRAME.

I am having issues accessing the cookie. If I use a debuger I can see the
cookie via a quickwatch looking at window.frames['name].document.cookie
however when I run the code the same variable is empty. Does anyone have any
ideas??


The new page in the iframe needs to be loaded before document.cookie in
that frame window can have the new cookies so you need to wait to have
the page loaded.
As you want to access the cookies from the containing window it is best
you define a function there
function processCookies (cookies) {
...
}
and then in the new frame loaded in the iframe you do
if (parent && parent.processCookies) {
parent.processCookies(document.cookie);
}
--

Martin Honnen
http://JavaScript.FAQTs.com/
Jul 23 '05 #3

"Erwin Moller"
<si******************************************@spam yourself.com> wrote in
message news:42***********************@news.xs4all.nl...
Paul Brant wrote:
Hi all,

I have a page with an IFRAME in it. From a script in the main ( parent ) page I instruct the IFRAME to load a specific URL. The URL contains
parameters that are processed by the server. The server then writes a
result cookie into the content destined for the IFRAME.

I am having issues accessing the cookie. If I use a debuger I can see the cookie via a quickwatch looking at window.frames['name].document.cookie
however when I run the code the same variable is empty. Does anyone have
any ideas??

Many thanks for your responses//

Paul


Hi

Is the URL in the IFRAME on the same domain as the mainpage?

Regards,
Erwin Moller


Hey Erwin,

While I do not specifiy a domain within the server code both pages load from
the same host !

Regards,

Paul
Jul 23 '05 #4

"Martin Honnen" <ma*******@yahoo.de> wrote in message
news:42*********************@newsread2.arcor-online.net...


Paul Brant wrote:

I have a page with an IFRAME in it. From a script in the main ( parent ) page I instruct the IFRAME to load a specific URL. The URL contains
parameters that are processed by the server. The server then writes a result cookie into the content destined for the IFRAME.

I am having issues accessing the cookie. If I use a debuger I can see the cookie via a quickwatch looking at window.frames['name].document.cookie
however when I run the code the same variable is empty. Does anyone have any ideas??


The new page in the iframe needs to be loaded before document.cookie in
that frame window can have the new cookies so you need to wait to have
the page loaded.
As you want to access the cookies from the containing window it is best
you define a function there
function processCookies (cookies) {
...
}
and then in the new frame loaded in the iframe you do
if (parent && parent.processCookies) {
parent.processCookies(document.cookie);
}
--

Martin Honnen
http://JavaScript.FAQTs.com/


Hey Martin,

many thanks for your post. I have progressed as a result of it. Given I own
the source to the server I decided to move away from cookies. I am however
ensuring that the document is loaded before proceeding. My iframe now calls
setResult on the following:

var processResult = new function() {
var scratch;

this.setResult = function(result) {
scratch = result;
}

this.getLastResult = function() {
return scratch;
}
}
I see scratch get set. When the parent (main) window then calls
getLastResult i get undefined. If I debug I see the variable set corrently.
Again.. if you have any thoughts I would be grateful.

Paul
Jul 23 '05 #5

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

Similar topics

1
by: Julius Mong | last post by:
Dear all, I have something like this: <html... > <embed ...> </html> Am I out of luck if I wanted to access the embedded DOM and manipulate its content? Or if I have:
4
by: Thomas | last post by:
Hi there, I have an iframe which is editable (designMode = "on") and want to resize it dynamically as the content grows (e.g. more lines of text is in there) and there the struggle starts. I...
2
by: Richie | last post by:
I have a situation where I'd like to read/parse the content of a file I've read into an <IFRAME>. I've looked through various FAQs and searched forums, and the closest I get to accessing the file...
2
by: Tom Szabo | last post by:
"Tom Szabo" <tom@intersoft.net.au> wrote in message news:419fe530$1@dnews.tpgi.com.au... > Hi All, > > I have a page and inside the page I have an IFRAME. From the page I like to > change the...
1
by: threepins | last post by:
Hi, I was wondering if it is possible to access an <img> tag that is buried within some external content in my site that is contained within an iFrame on a page within my site... confusing i...
2
by: Jeronimo Bertran | last post by:
Hi, I have a page with a very data intensive grid which needs to be automatically refreshed constantly if a change is detected. In order to not refresh the complete page so often, I created an...
3
by: CJ | last post by:
I have a page with a bunch of iframes (which make up a tab control). At least one of these iframes contains an aspx page, which in turn contains a .ascx component. This component then contains a...
19
by: k.karthikit | last post by:
Hello all, In some hidden variable (<input type="hidden" name="hiddenId" value="test" /> ,i stored some value.I accessed the value "test" using var id = document.getElementById( 'hiddenId' );...
14
by: Aaron Gray | last post by:
Hi, I want to access the properties of an IFrame but seem unable to get access to the IFrames document body. <html> <body> <iframe src="test.html" id="IFrame"></iframe> </body>
1
by: CloudSolutions | last post by:
Introduction: For many beginners and individual users, requiring a credit card and email registration may pose a barrier when starting to use cloud servers. However, some cloud server providers now...
0
by: Faith0G | last post by:
I am starting a new it consulting business and it's been a while since I setup a new website. Is wordpress still the best web based software for hosting a 5 page website? The webpages will be...
0
by: ryjfgjl | last post by:
In our work, we often need to import Excel data into databases (such as MySQL, SQL Server, Oracle) for data analysis and processing. Usually, we use database tools like Navicat or the Excel import...
0
by: taylorcarr | last post by:
A Canon printer is a smart device known for being advanced, efficient, and reliable. It is designed for home, office, and hybrid workspace use and can also be used for a variety of purposes. However,...
0
by: Charles Arthur | last post by:
How do i turn on java script on a villaon, callus and itel keypad mobile phone
0
by: aa123db | last post by:
Variable and constants Use var or let for variables and const fror constants. Var foo ='bar'; Let foo ='bar';const baz ='bar'; Functions function $name$ ($parameters$) { } ...
0
by: ryjfgjl | last post by:
In our work, we often receive Excel tables with data in the same format. If we want to analyze these data, it can be difficult to analyze them because the data is spread across multiple Excel files...
0
BarryA
by: BarryA | last post by:
What are the essential steps and strategies outlined in the Data Structures and Algorithms (DSA) roadmap for aspiring data scientists? How can individuals effectively utilize this roadmap to progress...
1
by: nemocccc | last post by:
hello, everyone, I want to develop a software for my android phone for daily needs, any suggestions?

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.