Javascript DOM onafterprint Event

Introduction

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

The onafterprint event is not supported in Safari and Opera.

In IE, the onafterprint event occurs before the print dialogue box, instead of after.

View in separate window

<!DOCTYPE html>
<html>
<body onafterprint="myFunction()">
<p id="demo"></p>
<script>
function myFunction() {// w w w .  ja v a 2 s .  c  om
  document.getElementById("demo").innerHTML = "This document is now being printed";
}
</script>

</body>
</html>



PreviousNext

Related