Apple Event: May 7th at 7 am PT

Looks like no one’s replied in a while. To start the conversation again, simply ask a new question.

window.print() or document.execCommand('print', false, null) using twice shows alert message

When using window.print() or document.execCommand('print', false, null) using javascript it shows alert message "This webpage is trying to print. Do you want to print this webpage?"


Steps to reproduce.

1) enter window.print() in console.

2) when print dialog opens. Select cancel.

3) enter window.print() again in console.


Safari thinks printing is still going on and displays alert message. See attached screenshot.

Note: If you select "print" and continue print. It doesn't display message.

Safari version: Version 15.3 (16612.4.9.1.8, 16612)

macOS version Big Sur: 11.6 (20G165)



MacBook Pro (2020 and later)

Posted on Feb 11, 2022 5:22 PM

Reply
4 replies

Feb 12, 2022 4:08 PM in response to ToApple

Hi ToApple, We appreciate you reaching out to us. We understand that when you use "window.print()" or "document.execCommand('print', false, null)" in javascript it shows you an alert message saying "This webpage is trying to print. Do you want to print this webpage?"

First, we recommend that you check if the behavior persists when signed in on a different user account. 

The article below can help if you do not have any other user account to test with.

Set up users, guests, and groups on Mac


If you are experiencing the behavior when signed in on a different user account, we recommend that you check if the issue persists while on safe mode. 

Below is an article to help guide you through the process.

How to use safe mode on your Mac



Take care!

window.print() or document.execCommand('print', false, null) using twice shows alert message

Welcome to Apple Support Community
A forum where Apple customers help each other with their products. Get started with your Apple ID.