This site will have limited functionality while we undergo maintenance to improve your experience. If an article doesn't solve your issue and you want to ask a question, we have our support community waiting to help you at @FirefoxSupport on Twitter and/r/firefox on Reddit.

Search Support

Avoid support scams. We will never ask you to call or text a phone number or share personal information. Please report suspicious activity using the “Report Abuse” option.

Learn More

Popup not communicating with parent/opener window

more options

I use an eCommerce system that when we are entering an item, a popup window will come up, asking us to choose the product. When I click the button that is supposed to link back to the parent/opener page with that product included, it does not link back and does not respond at all. Why is this a problem ONLY in Firefox? I have all the latest updated plug-ins (besides Google Earth and Yahoo! plug-ins). I even disabled pop-ups thinking that would help (not so much).

I use an eCommerce system that when we are entering an item, a popup window will come up, asking us to choose the product. When I click the button that is supposed to link back to the parent/opener page with that product included, it does not link back and does not respond at all. Why is this a problem ONLY in Firefox? I have all the latest updated plug-ins (besides Google Earth and Yahoo! plug-ins). I even disabled pop-ups thinking that would help (not so much).

All Replies (9)

more options

Can you recall whether this worked in earlier versions of Firefox?

There are certain restrictions in how windows communicate with one another, and these have evolved over time. Often if there is a security related reason for a feature failing, there will be an error in Firefox's Error Console (Ctrl+Shift+j). I realize this might not lead to a solution unless you have some influence or control over the site, but you could take a look and see whether there are any relevant error messages. I suggest doing it in three steps. First clear the console and reload the page. Check for any errors. Next popup the selector and check again. Finally make your selection and check again.

more options

Thank you for your quick response. It is greatly appreciated.

I tried this in a version last year and it did the same thing. Prior to last year, I'm not sure if it worked then. I guess I could attempt to download an earlier version of Firefox.

In the error console it says "Timestamp: 8/2/2012 2:47:24 PM Error: TypeError: opener.iform is undefined Source File: https://xxxxxxxxxxxxxxxxxxxx Line: 44"

(I cleared the website source for security reasons). Does this mean that the coding in the HTML for the opener isn't properly written for use in Firefox?

more options

Let's check something. In the opener (original tab), press Ctrl+Shift+k to open the Web Console. Paste the following line of code and press Enter:


alert(typeof self.iform);

If you get something other than "undefined" then there appears to be a problem with the child window accessing the object in the opener. If you get "undefined", then the object reference is not valid in Firefox regardless of which window the code is in.

more options

I followed the steps and pressed enter after the line of code. A box opened up that said "object". I clicked the "OK" button and it says "undefined". Above that, there is a line that says: [14:59:50.951] Element referenced by ID/NAME in the global scope. Use W3C standard document.getElementById() instead. @ Web Console:1

Which I am not sure if that means anything. So from that it sounds like I cannot use this opener in Firefox, correct? Is it worth even attempting an older version?

more options

Did the line about ID/NAME appear when you ran my one line of code? That usually indicates that the person who wrote the script was relying on IE-style coding which doesn't always work in Firefox. Still, it is strange that you get "object" when you're in the same window but "undefined" in the other window.

If you want to try a little hacking, you could run this line of code in the opener window, then try the popup again. I'm trying to set the value of the iform variable to what it would be in IE, but since I can't see the page, it's a bit of a guess.


window.iform = document.getElementById("iform"); if (!window.iform) window.iform = document.forms["iform"];
more options

Yes, when I entered the code and pressed enter, the ID/NAME line, as well as the white box with "object" came up. After I press the "OK" button on the "object" box, is when it comes up with "undefined" in the web console.

Will the hacking do anything to change the code permanently? This is my work's webpage where we enter orders, and I don't want to do anything that will change anything permanently or mess anything up. Or does the line of code in the web console just test your line of code?

My work doesn't like us using Firefox because they believe it has less security than IE, but it's a lot faster and easier for me to work in it, so I prefer it over IE.

Could I be of any help by finding the code for the opener in the source of the parent window?

more options

The hacking -- which defines a new variable in the page -- is very temporary: it only lasts until you navigate to the next page. Nothing you do in Firefox can change the code on the server itself unless your server has extremely poor security design.

If the hack works, obviously you would want to have a way to apply it to the relevant pages in a more automated fashion. We can come back to that.

I know that many companies have "IE only" web applications. Microsoft was extremely successful with IE3/IE4 and ActiveX because they made web pages powerful. But also proprietary, and often painful to rewrite. That's understandable; who wants to spend time and money "fixing" something as long as IE will run it?

However, I don't think the security argument holds up. IT departments are justifiably nervous about add-ons, because they have privileges on the system that web pages do not have. And IT departments seldom have the resources to keep on top of individual configurations or the support issues all those variations can create. I think it's an opportunity for IT and users to work together as a team to build a company list of "known good" add-ons and best practices. In the end, that will make the business more productive and efficient, which should be everyone's goal, right?

more options

I pasted the line you had above in the opener window and the popup was able to communicate with the parent window just as it does in IE, so your code worked.

In order to have this working permanently, the code for the website would have to be re-written to include this, is that correct?

more options

In order to have this working permanently, the code for the website would have to be re-written to include this, is that correct?

That certainly would be the easiest solution. Basically, opener.iform doesn't work in modern browsers, and needs to be changed to a more standards-compliant reference.

In order to fully automate the hack in the interim, you could use a Greasemonkey userscript. This assumes you are permitted to install the Greasemonkey extension. There are many ways to write such a script, but without the ability to do hands-on testing, it's hard to avoid unintended consequences.

To make it a bit more convenient to use the hack manually, you can save it as a bookmarklet. A bookmarklet is a bookmark that runs a snippet of JavaScript code instead of navigating to a site.

First, copy this to the clipboard:


javascript:window.iform = document.getElementById("iform"); if (!window.iform) window.iform = document.forms["iform"]; void 0;

(Adding javascript at the beginning causes Firefox to interpret the script as code rather than a confused URL, and adding void 0 at the end prevents Firefox from reloading the page.)

Next, right-click your Bookmarks Toolbar and choose New Bookmark. If you don't normally display this toolbar, you can display it using either

Alt+v (opens classic View menu) > Toolbars > Bookmarks Toolbar
right-click a blank area of the tab bar or the "+" button > Bookmarks Toolbar

In the New Bookmark dialog, paste the code in as the Location. You can give the bookmark any name you like; usually something short works best.

Now, to add the iform variable to a page that needs it, just click the bookmark.