5

In my web app i want to integrate a print functionality. When the user clicks the print button, a new window is opening and the print dialog appears. With this code i want to achieve this:

    var win = window.open(url, '_blank');
    win.print();

It is working, but the problem is that in chrome the source window stops the javascript execution while the print dialog is open. How is it possible to prevent this?

Zicane
  • 61
  • 5
  • Can you share the complete code? – Karthick Manoharan Nov 27 '14 at 11:28
  • possible duplicate of [How can I create an Asynchronous function on Javascript?](http://stackoverflow.com/questions/9516900/how-can-i-create-an-asynchronous-function-on-javascript) – Etheryte Nov 27 '14 at 11:28
  • 1
    Here is an example code: http://jsfiddle.net/Zicane/7ntsb7hh/10/ – Zicane Nov 27 '14 at 11:59
  • 1
    @Zicane how to you fixed this problem? – Andy Sep 21 '17 at 21:36
  • @Andy, did anyone of you found a solution to this? – Rumit Parakhiya Aug 03 '18 at 10:54
  • Strangely, in my app the click callbacks do get executed, but setInterval callbacks don't, here's a codepen illustrating this: https://codepen.io/anon/pen/wRMGrb I would actually expect the page to stop execution completely, since JS is single threaded, and I'm just really curious what is actually happening there. – Ivan Dec 13 '18 at 16:06

0 Answers0