重新加载IFRAME而不添加历史记录 [英] Reload an IFRAME without adding to the history
问题描述
我改变了一个IFRAME的 src
以便重新加载它,它的工作正常并且触发了 onload
事件当它的HTML加载。
但它增加了一个条目到我不想要的历史。有没有什么方法可以重新加载IFRAME,但不会影响历史记录?
://developer.mozilla.org/en/window.locationrel =noreferrer> location.replace
: window.location.replace('... html');
用提供的
替换当前文档URL。与assign()方法的
差异是
,在使用replace()之后,当前
页面将不会保存在会话
历史记录中,这意味着用户不会是
能够使用后退按钮来
导航到它。
I'm changing an IFRAME's src
in order to reload it, its working fine and firing the onload
event when its HTML loads.
But it adds an entry to the history, which I don't want. Is there any way to reload an IFRAME and yet not affect the history?
You can use javascript location.replace
:
window.location.replace('...html');
Replace the current document with the one at the provided URL. The difference from the assign() method is that after using replace() the current page will not be saved in session history, meaning the user won't be able to use the Back button to navigate to it.
这篇关于重新加载IFRAME而不添加历史记录的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!