Tìm kiếm hỗ trợ

Tránh các lừa đảo về hỗ trợ. Chúng tôi sẽ không bao giờ yêu cầu bạn gọi hoặc nhắn tin đến số điện thoại hoặc chia sẻ thông tin cá nhân. Vui lòng báo cáo hoạt động đáng ngờ bằng cách sử dụng tùy chọn "Báo cáo lạm dụng".

Learn More

Page always loads from cache unless refreshing

  • 2 trả lời
  • 1 gặp vấn đề này
  • 17 lượt xem
  • Trả lời mới nhất được viết bởi 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?

Tất cả các câu trả lời (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.