Search Support

Avoid support scams. We will never ask you to call or text a phone number or share personal information. Please report suspicious activity using the “Report Abuse” option.

Learn More

Cannot reload page by reload JS function after click print button

  • No replies
  • 1 has this problem
  • 2 views
more options

I wrote a JS function in order to print the modal window in the page and reload page link after print done. But I faced problem that after I click print button, the reload function didn't working. Below are the JS source code

<script language="javascript" type="text/javascript"> function printDiv(divName) {

 var printContents = window.document.getElementById(divName).innerHTML;
 document.body.innerHTML = printContents;
 window.print();

// window.location.href= window.location.href; // window.history.go(0); }; window.onafterprint = function() {

   window.location.reload(true);

}; </script>

You must log in to your account to reply to posts. Please start a new question, if you do not have an account yet.