0

Iam working on reloading of a webpage after printing it in PDF Format.So after printing i provided a window.location.reload method.It works fine in Chrome but not on Firefox.How Can I get rid of this problem?

printDocument = () => {
  const { match } = this.props;
  const { orderNo } = match.params;
  this.setState({ showPickSheet: true }, () => {
    const printContents = document.getElementById("divToPrint").innerHTML;
    document.title = `PickSheet_${orderNo}`;
    const originalContents = document.body.innerHTMl;
    document.body.innerHTML = printContents;
    window.print();
    document.body.innerHTML = originalContents;
    window.location.reload();
  });
};
August Lilleaas
  • 54,010
  • 13
  • 102
  • 111
Nandu Aji
  • 27
  • 6

3 Answers3

1

https://developer.mozilla.org/en-US/docs/Web/API/Location/reload There it location.reload(forcedReload); Add true into the reload function. it should work everywhere.

// Reload the current page without the browser cache
location.reload(true);
Gugu
  • 193
  • 1
  • 8
  • Check out this thread : https://stackoverflow.com/questions/18967532/window-location-reload-not-working-for-firefox-and-chrome – Gugu Aug 19 '19 at 07:56
0

This works in both chrome and firefox.

location.reload();
Smit Vora
  • 470
  • 3
  • 10
0
setTimeout(function(){
  window.location.reload();
});

You can use this it works in both firefox and chrome

Rahul Rana
  • 455
  • 2
  • 7