gpt4 book ai didi

javascript:history.back() 和上一页刷新

转载 作者:行者123 更新时间:2023-11-29 20:02:21 25 4
gpt4 key购买 nike

我的页面上有按钮 <span id="back" class="button" onclick="location.href='javascript:history.back()';"效果很好,但我需要它来刷新上一页。问题是,history.back() 是我唯一可以接受的方式,window.refferer 没有帮助。我已经尝试了一些使用元标记的技巧,但仍然一无所获。

最佳答案

如果您使用的是 HTML 5,则可以使用 the popstate event

The popstate event is fired in certain cases when navigating to a session history entry.

但我认为在以前的版本中没有办法做到这一点。

浏览器不知道您是通过 history.back() 到达页面的——没有您可以从 javascript(在 HTML 5 之前)引用的触发事件

关于javascript:history.back() 和上一页刷新,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/13708499/

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