473,407 Members | 2,359 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,407 software developers and data experts.

Javascript created IFrame document, weird domain issue

I have an IFrame whose document is created completely by Javascript code at
runtime. The document in the IFrame accesses Javascript functions in the
top level document. This works fine most of the time. But every now and
then, when I hit the back button, the browser suddenly thinks the Javascript
created document in the IFrame is not from the same domain as the topmost
document, and therefore I start getting "permission denied" errors when I
try to access the top level document's Javascript functions.

If I look at the IFrame document's properties (Mozilla->This Frame->View
Info), it shows the expected URL with a domain name that matches the top
level document.

Anyone got any ideas on why this is happening and what I can do to prevent
it?

Thanks.
Aug 3 '05 #1
2 2859
VK

Robert Oschler wrote:
I have an IFrame whose document is created completely by Javascript code at
runtime. The document in the IFrame accesses Javascript functions in the
top level document. This works fine most of the time. But every now and
then, when I hit the back button, the browser suddenly thinks the Javascript
created document in the IFrame is not from the same domain as the topmost
document, and therefore I start getting "permission denied" errors when I
try to access the top level document's Javascript functions.

If I look at the IFrame document's properties (Mozilla->This Frame->View
Info), it shows the expected URL with a domain name that matches the top
level document.

Anyone got any ideas on why this is happening and what I can do to prevent
it?


Reminds me a reversed case of this one:
<http://groups-beta.google.com/group/comp.lang.javascript/browse_frm/thread/8005d8ef77288c39/186b0f8e07897987?q=group:comp.lang.javascript+auth or:VK&rnum=39&hl=en#186b0f8e07897987>

Try:
1) iframe has only ID (no NAME) property
2) don't use any names for addressing:
window.frames[0].functionName (to address a function in the main
window)
self.parent.functionName ((to address a function in iframe).
ALSO: upon reloading (or form submission) frames and specially iframes
tends to not remember their parents.

Aug 3 '05 #2

"VK" <sc**********@yahoo.com> wrote in message
news:11*********************@g49g2000cwa.googlegro ups.com...


Reminds me a reversed case of this one:
<http://groups-beta.google.com/group/...se_frm/thread/
8005d8ef77288c39/186b0f8e07897987?q=group:comp.lang.javascript+auth or:VK&rnu
m=39&hl=en#186b0f8e07897987>
Try:
1) iframe has only ID (no NAME) property
2) don't use any names for addressing:
window.frames[0].functionName (to address a function in the main
window)
self.parent.functionName ((to address a function in iframe).
ALSO: upon reloading (or form submission) frames and specially iframes
tends to not remember their parents.


VK,

Thanks!

I'm not sure if understand the "self.parent.functionName()" statement here.
Your note says "to address a function n iframe", but wouldn't that address a
function in the iframe's parent instead? (Assuming "self" here refers to
the iframe)

Also, based on your "upon reloading" warning, wouldn't the
"self.parent.functionName()" be problematic?

Thanks.
Aug 3 '05 #3

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

Similar topics

11
by: Eric Osman | last post by:
Let's say I want to filter the contents of a target web page, and present a simpler page on the screen. For example, let's say a target web page is full of links, text, images, forms, etc. and...
6
by: Wendi | last post by:
If i have an iframe from within an HMTL document: Iframe.htm: ------------------------------ <html> <head> <title>Iframe.htm</title> </head> <body> <iframe src="sample.htm"></iframe>
7
by: Lorenzo Vaina | last post by:
Can i get the content of an URL and put it in a variable using javascript? I want js execute different operations varying a file that is on internet. Thanks, regards.
3
by: Wysiwyg | last post by:
After a server created cookie is processed on the client I want it removed, cleared, or expired in the javascript block but have been unable to do this. If I set a cookie value in the server code...
7
by: unacoder | last post by:
Is it possible to request the user's permission to be able to control IE or FireFox windows that are pointed to domains other than the base domain the script is running from? For example, if my...
15
by: Phlip | last post by:
Javascripters: I have an outer page and an inner iframe. The outer page calculates some javascript, and wants the inner frame to run it. The inner frame should hit a page on the same (private)...
7
by: Tom Cole | last post by:
IFrames have been used by years for people to accomplish many of the tasks the XMLHttpRequest does for them now...I unfortunately am late in the game and XMLHttpRequest was already out there by the...
5
by: brad | last post by:
I'll post my code below. My goal is to grab the selected text in an iFrame from javascript (really any way possible). When I highlight text in the iFrame and click the link outside of the iFrame, I...
7
by: kaer | last post by:
I have to send an XPath request on web page with JavaScript (with XMLHttpRequest) that has to be executed before. I have no idea on how to do that. Any pointer is welcome.
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: emmanuelkatto | last post by:
Hi All, I am Emmanuel katto from Uganda. I want to ask what challenges you've faced while migrating a website to cloud. Please let me know. Thanks! Emmanuel
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: Sonnysonu | last post by:
This is the data of csv file 1 2 3 1 2 3 1 2 3 1 2 3 2 3 2 3 3 the lengths should be different i have to store the data by column-wise with in the specific length. suppose the i have to...
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,...
0
Oralloy
by: Oralloy | last post by:
Hello folks, I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>". The problem is that using the GNU compilers,...
0
jinu1996
by: jinu1996 | last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven...
0
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...

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.