【发布时间】:2012-08-13 14:06:35
【问题描述】:
我正在使用一个名为 facebox 的 jquery 插件。它工作得很好,但我面临着!有问题。看起来它的 iframe 方法导致我的浏览器缓存正在加载到目标页面中的 css。
这就是我在 jquery 就绪状态的页面中调用它的方式。
$('a.participate').click( function(){
$.facebox({
iframe: '" . $urlparticipate . "',
rev: 'iframe|550|550'
});
return false ;
});
其中 $urlparticipate 是将在 iframe 中打开的 url。 我仔细查看了facebox.js,发现插件似乎使用了以下方法来创建iframe。
function fillFaceboxFromIframe(href, klass, height, width) {
$.facebox.reveal('<iframe scrolling="auto" marginwidth="0" width="'+width+'" height="' + height + '" frameborder="0" src="' + href + '" marginheight="0"></iframe>', klass)
}
如何防止 css 被缓存?我知道它正在被缓存,因为我更改了元素的 css 样式。我什至更改了一些正在加载的 js 代码,它仍在加载旧代码。
我还尝试了以下方法:
-
在head中前端添加目标页面
meta http-equiv="Cache-control" content="no-cache"
meta http-equiv="Pragma" content="no-cache"
meta http-equiv="Expires" content="0"
-
我尝试从后面的代码 (php) 中添加一些标头
header("Cache-Control: no-cache");
header("Pragma: no-cache");
一切都没有成功.. 我错过了什么?
【问题讨论】:
标签: php javascript jquery facebox