I'm generating a printer-friendly page that automatically opens the browser's print dialog box upon user visit. Is there a way to close the window if the user presses "Cancel"?
window.close()
closes the current window
you can do like.
<button type="button" id="cancelButton">Cancel</button>
$('#cancelButton').click(function(){
window.close();
});