Warning: file_get_contents(/data/phpspider/zhask/data//catemap/3/html/90.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
Html js/iframes:强制重新加载iframe_Html_Iframe_Javascript - Fatal编程技术网

Html js/iframes:强制重新加载iframe

Html js/iframes:强制重新加载iframe,html,iframe,javascript,Html,Iframe,Javascript,如何强制iframe重新加载而不是从缓存加载 someIframe.src += "#forceReload"; 应该有用。或: someIframe.src += "?fakeQuery"; 要强制它每次重新加载,请向其URL添加一个随机GET参数: iframe.src = "testpage.html?reload="+Math.random();# 或者正如Jacob所建议的,当前时间戳(消除重复的可能性): 更好的是,iframe.src=“testpage.html?reloa

如何强制iframe重新加载而不是从缓存加载

someIframe.src += "#forceReload";
应该有用。或:

someIframe.src += "?fakeQuery";
要强制它每次重新加载,请向其URL添加一个随机GET参数:

iframe.src = "testpage.html?reload="+Math.random();#
或者正如Jacob所建议的,当前时间戳(消除重复的可能性):


更好的是,
iframe.src=“testpage.html?reload=“+(new Date()).getTime()因为您可以得到相同的随机数;)@acewundabar如果您想要更详细的解释,您需要显示当前用于嵌入iframe的代码,并可能解释有关您的情况的更多信息。@acewundabar您可以编辑您的问题并添加信息。@acewundabar请解释您的情况以及您想做什么。我不打算解释给iframe一个新的src的所有1500种方法。
iframe.src = "testpage.html?reload="+(new Date()).getTime();