I want to detect if the user click the print or cancel button in the printing options in the browser for certain pages (e.g. File -> Print Preview, Print). I like to display a message (separate message if the user click cancel or print).
Here's my code:
function printCheckout() {
(function() {
if(print){
///if print button click
} else {
///cancel button click
}
}());
window.print();
}