【发布时间】:2014-03-28 09:57:10
【问题描述】:
Firefox 在刷新之前不会重新加载具有相同 url 的图像。
$("#a").click(function(){$("#img").attr("src","img.php?id=3");});
<img id="img" src="img.php?id=3">
//the two line above are in the same html page.And when the html page is loaded
// in the browser, i open a new tab and go to the php page that includes
//the line below.
mysql_query("update images set data=$data where id=3");//changing the image here
然后我回到html页面并单击#a,在Firefox中显示旧图像,因此除非刷新html页面,否则它不会询问mysql是否更改了id = 2的图像。但在chrome中显示了新的,更改的图像。它再次询问 mysql,不关心 url 是否仍然相同。
我希望 chrome 的行为类似于 firefox。尝试设置过期、上次修改等标头以不进行缓存,但它以不同的方式工作。据我所知,它没有缓存我正在寻找的内容。无论如何,这是对我来说是一个非常重要的问题,我将不胜感激。
【问题讨论】:
-
你能发布你的 img.php 和第一页的全图吗,我没有得到你想要做的事情
标签: javascript php jquery