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?
Is
framesa global variable? If so you are running up againstwindow.frameswhich contains references to all of the frames on the page.Rename the variable to something else and see if the problem goes away.