addEventListener("afterprint", myFunction) - Javascript DOM Event

Javascript examples for DOM Event:addEventListener

Introduction

The onafterprint event occurs when a page has started printing, or if the print dialogue box has been closed.

Summary

Bubbles No
Cancelable No
Supported HTML tags: ?<body>

Demo Code

ResultView the demo in separate window

<!DOCTYPE html>
<html>
<body>

<h1>Try to print this document</h1>

<script>
window.addEventListener("afterprint", myFunction);

function myFunction() {//from ww  w .  j  a v a 2 s .c om
    console.log("This document is now being printed");
}
</script>

</body>
</html>

Related Tutorials