Use the HTML onafterprint attribute to execute the script after the document prints or is being printed.
You can try running the following code to achieve onafterprint Attribute -
<!DOCTYPE html> <html> <body onafterprint = "display()"> <script> function display() { alert("Success!"); } </script> </body> </html>
The above is the detailed content of Execute script after printing document in HTML?. For more information, please follow other related articles on the PHP Chinese website!