简体   繁体   English

加载一次刷新页面

[英]Refresh page on load once

this should be so simple but I can't get it to work, all I want to do is to refresh my page immediately once when it is loaded.这应该很简单,但我无法让它工作,我要做的就是在页面加载后立即刷新我的页面。 I don't want to stop caching as much of the data on my site stays the same.我不想停止缓存,因为我网站上的大部分数据保持不变。 I don't want to go to a different url ie www.mysite.com/page1.php?refreshedpage because my url's are clean and easy to follow.我不想 go 到不同的 url 即 www.mysite.com/page1.php?

I have images using the same file name which get changed, hence when a user accesses my site, they see the old cached images.我有使用相同文件名的图像,这些图像会被更改,因此当用户访问我的网站时,他们会看到旧的缓存图像。

Cheers干杯

Add to your images something like the following:添加到您的图像中,如下所示:

<img src="/images/image.jpg?refresh=20110524" />

I just used the date, but you can use whatever you want.我只是使用日期,但你可以使用任何你想要的。 This will trigger the browser to think it is a new image, and will download it, instead of using the cache, for all users.这将触发浏览器认为这是一个新图像,并将为所有用户下载它,而不是使用缓存。

No matter what querystring you use, after the image file name, it will still load the same image, although the browser will think it's a different image.无论您使用什么查询字符串,在图像文件名之后,它仍然会加载相同的图像,尽管浏览器会认为它是不同的图像。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM