gpt4 book ai didi

javascript - window.location.reload 在 Chrome 中工作正常,但在 Firefox 中不起作用

转载 作者:行者123 更新时间:2023-12-02 23:07:25 26 4
gpt4 key购买 nike

我正在以 PDF 格式打印网页后重新加载网页。所以打印后我提供了一个 window.location.reload 方法。它在 Chrome 中工作正常,但在 Firefox 上不行。我怎样才能摆脱这个问题?

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();
});
};

最佳答案

https://developer.mozilla.org/en-US/docs/Web/API/Location/reload在那里它location.reload(forcedReload);将 true 添加到重新加载函数中。它应该可以在任何地方工作。

// Reload the current page without the browser cache
location.reload(true);

关于javascript - window.location.reload 在 Chrome 中工作正常,但在 Firefox 中不起作用,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/57523197/

26 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com