window.onbeforeprint = function() { console.log('This will be called before the user prints.'); }; window.onafterprint = function() { console.log('This will be called after the user prints'); window.location.reload() };