I want to remove iframe's content but keep the "iframe tag" unchanged like:
<iframe>
<html>
...
</html>
</iframe>
change to
<iframe>
</iframe>
I tried this:
var frame_node = document.getElementsByTagName("iframe")[0];
frame_node.removeChild(frame_node.firstChild);
But I got an error: frame_node.firstChild is not an object
So how to do this? thx
got the answer:
document.getElementsByTagName("iframe")[0].contentWindow.document.getElementsByTagName("html")[0].remove();