unable to execute a JavaScript function from an iFrame, after it is removed and added

RESOLVED DUPLICATE of bug 170799

Status

()

--
major
RESOLVED DUPLICATE of bug 170799
9 years ago
8 years ago

People

(Reporter: moshe.ravid, Unassigned)

Tracking

2.0 Branch
x86
Windows 7
Points:
---

Firefox Tracking Flags

(Not tracked)

Details

(Reporter)

Description

9 years ago
User-Agent:       Mozilla/5.0 (Windows; U; Windows NT 6.1; en-US; rv:1.9.1.10) Gecko/20100504 Firefox/3.5.10
Build Identifier: Mozilla/5.0 (Windows; U; Windows NT 6.1; en-US; rv:1.9.1.10) Gecko/20100504 Firefox/3.5.10

Hi there, this issue is kinda strange, and happens only in Firefox (v. 3.6.6 but also in older versions of 3.6, and maybe older version too - but i didn't check it). The best way to explain it is to describe the scenario, so.. here it is:

   1. I have two HTML pages: Page-A & Page-B. Page-A contains an iframe element, which its source points to Page-B.
   2. Page-B contains a JavaScript function: foo. for the sake of this example, this function only pops-up an alert.
   3. when Page-A is loaded for the first time, i'm able to get the iframe and execute the

JavaScript function like this:

window.frames["frameName"].foo();

Until now looks normal. but, when I dynamically remove the iframe from Page-A, and then dynamically adds it to the page, this is what happens:

** i can get the instance of iframe: window.frames["frameName"]

** when i try to execute the foo() function, i get an error that it is undefined.

This issue happens ONLY in Firefox. Testes in: IE 7/8, Chrome & Safari - works fine.

Reproducible: Always

Steps to Reproduce:
The steps to reproduce described in the bug details.
Actual Results:  
When e execute the function i get an error that the function is undefined. 

Expected Results:  
function execution.
Reporter, are you still seeing this issue with Firefox 4.0.1 or later in safe mode or a fresh profile? If not, please close. These links can help you in your testing.
http://support.mozilla.com/kb/Safe+Mode
http://support.mozilla.com/kb/Managing+profiles
Whiteboard: [CLOSEME 2011-05-30]
Version: unspecified → 3.5 Branch
No reply, INCOMPLETE. Please retest with Firefox 4 or later and a new profile (http://support.mozilla.com/kb/Managing+profiles). Also, ensure you have the most up to date graphics drivers, operating system updates, and plugin versions (flash, java, etc). If you continue to see this issue with the newest Firefox and a new profile, then please comment on this bug.
Status: UNCONFIRMED → RESOLVED
Last Resolved: 8 years ago
Resolution: --- → INCOMPLETE
(Reporter)

Comment 3

8 years ago
It is still reproducible - happens also with Firefox 4.0.1.
Windows 7, 64bit with all the latest updates.
Component: General → General
Product: Firefox → Core
QA Contact: general → general
Whiteboard: [CLOSEME 2011-05-30]
Version: 3.5 Branch → 2.0 Branch
> ** i can get the instance of iframe: window.frames["frameName"]

This is giving you the old window in the iframe, not the new one, due to bug 170799.

As a workaround, you could put id="frameName" on the <iframe> and use document.getElementById("frameName").contentWindow.foo()....
Resolution: INCOMPLETE → DUPLICATE
Duplicate of bug: 170799
You need to log in before you can comment on or make changes to this bug.