短暂等待后强制重新加载 html 页面
我有一个 html 页面 A 和页面中的一个链接,该链接在新窗口中打开页面 B。 如何在单击并打开此链接时重新加载页面 A?
编辑:
我应该更清楚。 页面 B 在新窗口中打开,而不是作为弹出窗口打开。 相关超链接的目标属性设置为 _blank。 从我得到的答案中得到线索(谢谢大家!),我尝试设置 onclick = "window.location.reload()" 并且它工作得很好。
但是我有一个问题。 事实上,这完全是另一个问题。 如何确保页面A的重新加载等待在新窗口中打开的页面(页面B)加载?
I have a html page A and a link in the page which opens up page B in a new window. How to reload the page A on clicking and opening this link ?
EDIT:
I should have been more clear. Page B opens in a new window and not as a popup. The hyperlink in question has its target attribute set to _blank. Taking a clue from the answers that I got (Thanks guys !), I tried setting onclick = "window.location.reload()" and it works perfectly fine.
However I have a problem. In fact another question altogether. How to make sure that the reload of page A waits until the page opened in the new window (page B) loads ?
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(5)
像这样的东西:
Something like this:
最简单的方法是,
如果我没记错的话,应该打开窗口,然后由于返回未被抑制,因此将重新加载页面。
The simplest way would be to do
If I remember correctly that should open the window and then since the return has not been suppresed will reload load the page.
根据您的措辞,我不确定这是否是您想要的,但是如果您想从弹出窗口中的链接重新加载打开的窗口,请尝试
编辑,根据您的新评论,只需在正文加载中使用上面的代码新窗户
I am not exactly sure if this is what you want based on your wording, but if you want to reload the opening window from a link in the popup try
Edit, based on your new comments just use the code above in the body onload of the new window
您可以使用
setTimeout()
来延迟重新加载。You can use
setTimeout()
to delay the reload.尝试这个:
Try this: