Reputation: 1992
Here is some example code:
frames = document.getElementsByTagName('iframe');
parent = frames[0].parentNode;
parent.removeChild(frames[0]);
Works in Chrome/Webkit as a userscript. The iframe disappears. However, in Firefox, I will get an exception that parent has no function "removeChild" and that parent is OBJ Window.
Why? How do I work around this?
Upvotes: 1
Views: 348
Reputation: 207527
Is frames
a global variable? If so you are running up against window.frames
which contains references to all of the frames on the page.
Rename the variable to something else and see if the problem goes away.
Upvotes: 2