Html <;iframe>;重新加载页面时
我在同一目录中有三个简单的HTML文件: index.htmlHtml <;iframe>;重新加载页面时,html,iframe,Html,Iframe,我在同一目录中有三个简单的HTML文件: index.html <html> <head> <title>Page 1</title> </head> <body> <iframe src="page2.html"></iframe> </body> </h
<html>
<head>
<title>Page 1</title>
</head>
<body>
<iframe src="page2.html"></iframe>
</body>
</html>
然后,它打印正确的文件位置。(但是iframe
的内容仍然是错误的。)
这意味着,即使浏览器检测到文件已更改,在重新加载页面时,它甚至不会重新加载iframe
是什么导致了这种奇怪的行为?我怎样才能修好它
谢谢
使用Firefox 29进行测试
备注:(2)所有文件都在我的电脑上,我不会在远程服务器上获取它们。尝试添加以下内容:
document.getElementById(FrameID).contentDocument.location.reload(true);
这将强制iframe在每次重新加载页面时重新加载
编辑:我使用Chrome进行了尝试,即使没有脚本,效果也很好。如果您计划频繁更改此Iframe,我将通过Javascript动态创建Iframe(值得一提的是,您将在Iframe上释放FF缓存): HTML代码:
<!doctype html>
<html>
<head>
<title>Page 1</title>
</head>
<body>
<div id="iframe_wrapper"></div>
</body>
</html>
document.getElementById(FrameID).contentDocument.location.reload(true);
<!doctype html>
<html>
<head>
<title>Page 1</title>
</head>
<body>
<div id="iframe_wrapper"></div>
</body>
</html>
document.addEventListener("DOMContentLoaded", function(event) {
var iframeWrapper = document.getElementById("iframe_wrapper");
var iframe = document.createElement("iframe");
iframe.src="http://www.bing.com/";
iframe.width = "400";
iframe.height = "400";
iframeWrapper.appendChild(iframe);
});