Closed DmytroLynda closed 5 months ago
Hello. Apologies for the delayed response.
First, regarding the window.close
, what window are you trying to close? The error seems reasonable: the browser is trying to prevent your script from closing the current window, which was presumably opened by the user when they went to your page, not be the script.
Second, regarding the early firing of onAfterPrint
, which browser are you using? This is a known issue for example in Safari.
Hi.
I've noticed, that the
onAfterPrint
may be called before printing iframe is opened. Here is my code:It seems to happen randomly when I open the page. So sometimes the print iframe is opened correctly, and sometimes it renders the component and calls window.close() before iframe is rendered.
I also get the following message in the console:
There is also the following error, but I get it even when the iframe is rendered successfully
Here is react-to-print version: "react-to-print": "^2.15.1",
Do you have any suggestions?