我正在尝试创建一个页面,刷新后会从URL列表中随机加载一个URL.到目前为止,我发现这样做的最好方法是让PHP从文件中随机获取该行,然后将其加载到iframe中.这也允许我在顶部栏上有一个关闭按钮,允许任何加载到iframe中的页面突破.
我遇到的问题是,在几次重新加载后,在firefox中,iframe刚开始恢复到缓存并且不会加载任何新内容.我猜这是一个缓存问题,因为按Ctrl + F5会使iframe加载一个新页面.
我试过放了一堆防缓存meta标签中,以及JavaScript的一个peice的,我就发现这个文章.
到目前为止没有任何工作.有没有人知道一个好的解决方法或在我的代码中看到错误(我非常新手).
谢谢你的帮助!
这是代码:
</html>
<head>
<META HTTP-EQUIV="Cache-Control" CONTENT="no-cache">
<META HTTP-EQUIV="Pragma" CONTENT="no-cache">
<meta http-equiv="expires" content="FRI, 13 APR 1999 01:00:00 GMT">
<script type="text/javascript" src="http://ajax.googleapis.com/ajax/libs/jquery/1.7.1/jquery.min.js"></script>
<script type="text/javascript">
function Ionload()
{
$(parent.document).find("iframe").each(function() {
// apply the logic only to the current iframe only
if(this.contentDocument == window.document) {
// if the href of the iframe is not same as
// the value of src attribute then reload it
if(this.src != location.href) {
this.src = this.src;
}
}
}); …Run Code Online (Sandbox Code Playgroud)