rana7cse rana7cse - 2 months ago 28
Javascript Question

Page not reloading after print the window with Jquery

Hey I don't know why my page is not reloading without cache after using

window.print()
. the window is reloading when i am typing
window.location.reload(true)
on browser console but not working after printing . I've try but can't figure-out why this is not working here.

$('#print_report').click(function(){
$('body').html($('#cashReport').html());
window.print();
return window.location.reload(true);
});

Answer

You can reload the page after the print process finishes.You can listen for the after print event using window.onafterprint

$('#print_report').click(function(){
      $('body').html($('#cashReport').html());
      window.print();
});

 window.onafterprint = function(){
      window.location.reload(true);
 }