I need to provide the ability to print a shortcut on successful save and after redirecting print to the search page. This works in chrome, firefox, i.e. iOS 6/7 safari, etc. However, it seems that iOS 8 no longer stops javascript execution when window.print () is issued from javascript.
If you go to this jsfiddle example from iOS 8 Safari (connected to your computer to view console logs) and click the "Print" button, you will see that console.log will fire when the print dialog is completed. Therefore, if you want to print and then move around, you will print the wrong screen if you do not have a delay that gives you enough time to print, which is unacceptable in this case.
I made an artificial delay because in iOS 6/7, which seemed to make the print dialog eventually stop javascript execution. In this case, 500 ms was enough to make it work.
Has anyone else seen this problem while doing a similar thing in iOS 8 from Safari? Did they present a new listening event that I could use to do this?
// Example Code window.print(); setTimeout(function() { console.log('This should print after the print is issued in the iOS print dialog.'); }, 500);
source share