javascript - window.document sometimes comes out undefined in IE10 -


javascript code below works fine in ie8 , older. creates pop-up window somehtml .

print_window = window.open('', 'blah', 'width=500,height=200,left=300,top=300'); doc = print_window.document; doc.write(somehtml); self.window = print_window; doc.close(); 

in ie10 code leaves doc variable 'undefined' generating javascript error on doc.write(). interesting when on page first time works subsequent times may or may not work. can advise on cause , how fix it? lot.

@jfriend00 please try simple code below , on second, third or fourth button click you'll blank window because window.document undefined. i'm running ie 10.0.9200.17377.

function opennew() {     print_window = window.open('', 'blah','width=500,height=200,left=300,top=300');     doc = print_window.document;     str = '<html><body bgcolor="#cccccc" text="#000000">new window</body></html>';     doc.write(str);     self.window = print_window;     doc.close(); }     <input id="button1" type="button" value="button" onclick="opennew()"/> 


Comments

Popular posts from this blog

php - Zend Framework / Skeleton-Application / Composer install issue -

c# - Better 64-bit byte array hash -

python - PyCharm Type error Message -