I am writing to an iframe via document.write then trying to overwrite the document on that same iframe. In FF this works properly. However, in chrome code from the initial document.write persists even after I overwrite it with a second document.write.
See this fiddle: http://jsfiddle.net/meQcC/
If you view it in FF as one would expect, the iframe is blank and you actually get a "function onLoad is not defined error" because in the line
doc.write("<html><head><script>;" +
"<\/script></head><body onload='onLoad()'></body></html>");
There is obviously no onLoad function defined. However, if you view the same fiddle in chrome, the iframe will display a black rectangle, and there will be no error regarding the onLoad call, it will call the previously defined function as though it still exists!!!!
Is there any way to clear the document in chrome so that I can overwrite the contents of the iframe without old code somehow persisting? Is this a bug in chrome?