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);
});
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);
});
Share
Improve this question
asked Aug 28, 2015 at 22:05
RanaRana
1882 silver badges15 bronze badges
2
- Try without "return". Just - window.location.reload(); – WebArtisan Commented Aug 28, 2015 at 22:10
- I've tried @Alicelf but not work. – Rana Commented Aug 28, 2015 at 22:16
5 Answers
Reset to default 5You 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);
}
It might be too late but I got to this issue and none of the solutions worked when using Print to PDF and some real printers also, I found the solution using:
setInterval(function(){
window.location.reload(true);
}, 200);
window.print();
Consider the afterprint event. See https://developer.mozilla/en-US/docs/Web/API/WindowEventHandlers/onafterprint
window.location.href = window.location.href ;
you can use this javascript function and call it after print
<script>
function refreshParent() {
window.opener.location.reload(true);
}
</script>