Is there a way to add a new class to the parent DIV only when the window.print() preview window is open? I've run into an issue where once the preview window opens, I'm unable to make any changes in the parent window. This seems to block all scripts from running in the parent window once the preview is displayed. I've researched extensively and found very few options like using "afterprint" or cancelling the print window, but my requirement is specifically for when the window is already open.
I attempted using beforeprint as well, but it triggers before the print window appears. My goal is to update the parent DIV class only when the print preview window is visible.
I have tested this in both Chrome and Firefox browsers.
If anyone has any suggestions on how to achieve this, I would greatly appreciate it.