I write in an iframe via document.write, then try to overwrite the document on the same iframe. In FF, this works correctly. However, in the chrome code from the original document .write is saved even after I overwrite it with the second document.write.
See this script: http://jsfiddle.net/meQcC/
If you view it in FF, as you would expect, the iframe is empty and you actually get the โonLoad function not defined errorโ, because in the line
doc.write("<html><head><script>;" + "<\/script></head><body onload='onLoad()'></body></html>");
Obviously, the onLoad function is not defined. However, if you look at the same script in chrome, the iframe will display a black rectangle, and there will be no error with respect to calling onLoad, it will call the previously defined function, as if it still exists !!!!
Is there a way to clear a document in chrome so that I can overwrite the contents of the iframe without any old code? Is this a mistake in chrome?
source share