搜索 | 用户支持

防范以用户支持为名的诈骗。我们绝对不会要求您拨打电话或发送短信,及提供任何个人信息。请使用“举报滥用”选项报告涉及违规的行为。

详细了解

Page always loads from cache unless refreshing

  • 2 个回答
  • 1 人有此问题
  • 2 次查看
  • 最后回复者为 divunij

more options

I am testing my website with Firefox, and came across a strange situation that i haven't found an answer to yet, and havent encountered in any other browser.

When I navigate through the website by clicking on links, the pages I visited are stored in cache and are always the ones to be loaded, even when going back to the same page VIA a link.

For example, on the homepage of the site there is a feed with the recent content updates, these content updates are pulled from the database, loading the page loads the last 20 items. Currently, the only way to see the updated page though is if i either click the refresh button, or if i do ctrl+r or any other manual refresh.

What is expected is that if I click on the link to go to the homepage, the home page will be loaded from the server, not from the cache, otherwise the pages are just not up to date.

This is happening with all of the pages, which means that if someone goes throught the website once, they will always see the same old data because none of the pages are pulled from the server after being viewed once. I find myself always having to refresh every page to see if there is an update, rather than just being able to go to that page by clicking on a link to it.

Is there any information on this or a way to fix this?

I am testing my website with Firefox, and came across a strange situation that i haven't found an answer to yet, and havent encountered in any other browser. When I navigate through the website by clicking on links, the pages I visited are stored in cache and are always the ones to be loaded, even when going back to the same page VIA a link. For example, on the homepage of the site there is a feed with the recent content updates, these content updates are pulled from the database, loading the page loads the last 20 items. Currently, the only way to see the updated page though is if i either click the refresh button, or if i do ctrl+r or any other manual refresh. What is expected is that if I click on the link to go to the homepage, the home page will be loaded from the server, not from the cache, otherwise the pages are just not up to date. This is happening with all of the pages, which means that if someone goes throught the website once, they will always see the same old data because none of the pages are pulled from the server after being viewed once. I find myself always having to refresh every page to see if there is an update, rather than just being able to go to that page by clicking on a link to it. Is there any information on this or a way to fix this?

所有回复 (2)

more options

I just realized where the issue is comming from, I still don't know how to handle it though.

I set up caching with this header: header('Cache-Control: private, max-age=86400');

I set it up to be able to take advantage of bfcache. The functinoality I expected from that was for the pages to be loaded from cache when the user presses the back/forward buttons. I did not expect that all pages would be loaded from cache in every case, even when going to them through a link.

So the question now is if there is a way to make it so that the pages will only be loaded from the cache if the user clicked the back/forward buttons?

more options

Well, i'm not sure if this is the correct way to fix it, but, if this helps anyone else, this helped me:

I change the Cacho control header to this: header('Cache-Control: no-cache, max-age=86400');

bfcache is working, and links are loading from the server.