Window.print() error in IE in res://ieframe.dll/preview.js

17,437

You can also get this error in IE10 if you are calling window.close() immediately after window.print(), especially if your DOM is large. My guess is that the page has not finished rendering when IE10 executes the window.print() call.

You can therefore get around this issue by:

  • Calling window.close() within a hover event on the page. A print dialgue will steal the user's focus, so the hover event wont fire until the user has finished dealing with the dialogue. We found this to be the best solution.
  • Not calling window.close() at all for IE10 clients
  • As window.print() does not have a callback, calling window.close() after an arbitrary delay. I wouldn't recommend this as it will be unreliable
  • Go "nuclear" with this answer, which loads the html into a hidden iFrame before printing, sidestepping the need to call window.close()
Share:
17,437
user942309
Author by

user942309

Updated on June 28, 2022

Comments

  • user942309
    user942309 almost 2 years

    Onclick of a anchor tag i am giving window.print(); call and I get the print pop-up. But on the click of print I get the following script error.

    An error occurred in the script on this page.
    Line: 2115
    Char: 1
    Error: Your file waiting to be printed was deleted.
    Code: 0
    URL : res://ieframe.dll/preview.js
    

    Do you want to continue with the script on the page(yes/no buttons)

    May what ever you click Yes/No I don't get the print or in IE8 i get a blank print.

    Firefox prints fine. But, fails in IE9.

    Can some one help me on this one??