View Full Version : window.open does not work on cloned content

02-16-2005, 06:34 AM
This problem only exists on Mozilla based browsers :(

I have a table with records. You click on an ADD button next to any of the records, and another record is inserted just beneath that record after selecting the type of record from a popup dialog box.

I use cloneNode and insertBefore or appendChild to accomplish this. It works fine in Internet Explorer but Mozilla refuses to execute the window.open command on any of the copied entries.

The error I get is:

Error: uncaught exception: Exception... "Component returned failure code: 0x804b000a nsIDOMJSWindow.open" nsresult: "0x804b000a (<unknown> )" location: "JS frame :: https://jupiter.tut.ac.za/jupiter/apps/research/dialog_problems/popups/dialog.js :: anonymous :: line 44" data: no

Here is a simplified example to show you what happens. It doesn't do much but should get the point over:


The index.htm contains two javascript functions and I have also linked the two JS files used in this demo.

02-17-2005, 10:47 AM
Got a solution from gso at mozillazine. By using <a href="javascript:add_entry(this)">here</a> it was possible to still call the wondow.open

I ended up using

<a onclick="currentnode=this" href="javascript:add_entry(currentnode);">here</a>
since calling the function this way prevents me from reading the A node as "this".

Don't know why Mozilla works like this. Might be a bug?