SitePoint Sponsor

User Tag List

Results 1 to 13 of 13
  1. #1
    SitePoint Enthusiast
    Join Date
    Dec 2003
    Location
    Raleigh, NC
    Posts
    44
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)

    Pages on my web site won't reload with F5

    If I make changes to any of the pages of my web site[1], in order for me to see the change, I have to press Ctrl-F5 to force a reload. Simply pressing F5 (or clicking the Reload button) will refresh the page, but it doesn't go back to the server to get the updated HTML. The pages are all static HTML.

    Other users have reported similar problems, some using Firefox, some using IE (both IE7 and IE8).

    Any ideas?

    [1] http://raleighlittletheatre.org

    Thanks.
    David.

  2. #2
    padawan silver trophybronze trophy markbrown4's Avatar
    Join Date
    Jul 2006
    Location
    Victoria, Australia
    Posts
    4,108
    Mentioned
    28 Post(s)
    Tagged
    2 Thread(s)
    Hi,

    Are you sure this is different to how other websites behave?
    As far as I know it's up to the browser how it handles the refresh button and F5 in the browser.

    You can send different headers when you serve pages to control caching but I don't believe you want to force it or make your pages expire quickly. Here's the first google results that came up on the topic.
    http://www.web-caching.com/mnot_tutorial/how.html

    I generally just accept how the cache works in the browser - if you are releasing things like news articles each day you may want to make those pages expire after a time - but that would be an exception.

  3. #3
    Programming Since 1978 silver trophybronze trophy felgall's Avatar
    Join Date
    Sep 2005
    Location
    Sydney, NSW, Australia
    Posts
    16,816
    Mentioned
    25 Post(s)
    Tagged
    1 Thread(s)
    That's the difference between F5 and ctrl-F5 with most browsers.

    F5 = refresh the page from the cache so as to restore it back the way it was before any JavaScript applied changes.

    ctrl-F5 = reload the page from the server ot pick up any changes made to the page source.
    Stephen J Chapman

    javascriptexample.net, Book Reviews, follow me on Twitter
    HTML Help, CSS Help, JavaScript Help, PHP/mySQL Help, blog
    <input name="html5" type="text" required pattern="^$">

  4. #4
    SitePoint Enthusiast
    Join Date
    Dec 2003
    Location
    Raleigh, NC
    Posts
    44
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    Thanks. That's what I thought, however one user reported that they were still seeing old information on the home page, and it turned out to be several weeks old, even though they'd visited the page several times over that time, and I had made several changes to the home page in that time. Very odd. I don't recall having this problem except in the past few months.
    David.

  5. #5
    Programming Since 1978 silver trophybronze trophy felgall's Avatar
    Join Date
    Sep 2005
    Location
    Sydney, NSW, Australia
    Posts
    16,816
    Mentioned
    25 Post(s)
    Tagged
    1 Thread(s)
    It partly depends on browser settings as to how long browsers keep cached copies of pages before they discard them and look for updates from the site.

    It can also depend on ISP caching since some ISPs cache pages that their users access regularly so as to save their having to constantly retrieve the pages and so provide faster access (which may not be completely up to date for a while after the page is changed).

    The headers you pass with the page can also advise as to how long you expect the information in the page to be current for.
    Stephen J Chapman

    javascriptexample.net, Book Reviews, follow me on Twitter
    HTML Help, CSS Help, JavaScript Help, PHP/mySQL Help, blog
    <input name="html5" type="text" required pattern="^$">

  6. #6
    SitePoint Wizard bronze trophy Black Max's Avatar
    Join Date
    Apr 2007
    Posts
    4,029
    Mentioned
    12 Post(s)
    Tagged
    0 Thread(s)
    Stephen, here's a related question: in Opera, when I try to refresh a page stored on my computer, neither F5 nor Ctrl+F5 does the trick. Any idea why?

    David, I've seen some productions at Raleigh's Little Theater. You guys do good work. But your dropdown nav doesn't work for me in Opera.

  7. #7
    Follow: @AlexDawsonUK silver trophybronze trophy AlexDawson's Avatar
    Join Date
    Feb 2009
    Location
    England, UK
    Posts
    8,111
    Mentioned
    0 Post(s)
    Tagged
    1 Thread(s)
    Max that's because F5 and Ctrl+F5 (Reload) have the same effect in Opera.

    I would purge your temporary files and try again (Opera does have a few weird caching quirks IMO).

  8. #8
    SitePoint Member
    Join Date
    Aug 2009
    Posts
    1
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    Hi,


    You shall Configure your browser not to get cache from your website,

    Hope this is helping,

  9. #9
    SitePoint Enthusiast
    Join Date
    Dec 2003
    Location
    Raleigh, NC
    Posts
    44
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    Thanks for all the replies. Yes clearing the cache certainly does the job but many visitors of my site have this problem, so that's not a viable solution. In some instances, the page they were seeing was weeks old.

    I think this particular site of mine has an unusual problem with caching. As I said in my first post, on this site of mine [1], when I make a change to the page, pressing F5 doesn't reload the page from the server, so I don't see the change. However on another site of mine [2] also static HTML pages, if I make a change, then press F5, the page IS reloaded from the server and I see the updated page. So clearly something is broken with my first site [1].

    I read through the link that markbrown4 gave me (above) to see what can be done to force an update. I've tried various settings in my .htaccess file and using the Live HTTP Headers plugin in FF, I can see that these settings are being picked up, but it is as if they are being ignored. Here are the things I added to the .htaccess file:

    # Expire after 2 DAYS
    <FilesMatch "\.(ico|pdf|flv|jpg|jpeg|png|gif|js|css|swf)$">
    Header set Cache-Control "max-age=172800, must-revalidate"
    </FilesMatch>

    # Expire after 1 HOUR
    <FilesMatch "\.(html|htm|xml)$">
    Header set Cache-Control "max-age=3600, must-revalidate"
    </FilesMatch>

    Even waiting an hour or more, if I press F5 still doesn't reload the page from the server, as I expected it to do.

    Pressing F5 should reload the page from the server as it does on other web sites including my site [2], but for some reason, F5 doesn't work on [1] (and I'm sure it used to, btw). There must be something on the server end, but I can't figure out what.

    [1] http://raleighlittletheatre.org
    [2] http://baretheatre.org

  10. #10
    SitePoint Enthusiast
    Join Date
    Dec 2003
    Location
    Raleigh, NC
    Posts
    44
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    Quote Originally Posted by Black Max View Post
    Stephen, here's a related question: in Opera, when I try to refresh a page stored on my computer, neither F5 nor Ctrl+F5 does the trick. Any idea why?

    David, I've seen some productions at Raleigh's Little Theater. You guys do good work. But your dropdown nav doesn't work for me in Opera.
    Max, Thanks for the pointer to Opera not working on the RLT site. I guess I need to install that and see what happens. Any particular version or OS?

  11. #11
    SitePoint Enthusiast
    Join Date
    Dec 2003
    Location
    Raleigh, NC
    Posts
    44
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    Any more suggestions as to what I can do to solve this problem? There is definitely something broken with the raleighlittletheatre.org site. If I make changes to a page, then the only way I can see those changes straight away is to press Ctrl-F5. If I make a similar change to a page on on my other site, baretheatre.org, pressing F5 will show the latest (or the updated page will just appear when I go there). I don't need to press Ctrl-F5.

    My big concern is that most of my users aren't aware of the Ctrl-F5 option, so they just don't see the changes I make in a timely fashion.

    David.

  12. #12
    SitePoint Enthusiast
    Join Date
    Dec 2003
    Location
    Raleigh, NC
    Posts
    44
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    OK the problem has been solved. I was able to have my problem escalated to my hosting company's senior admin and he looked into the problem. It turned out that FileETag was incorrectly enabled on the server where my site [1] was hosted. This apparently resulted in files been cached incorrectly. My other side [2] on a different server already had this setting disabled so it wasn't seeing the same problem.

    [1] http://raleighlittletheatre.org
    [2] http://baretheatre.org

  13. #13
    SitePoint Enthusiast
    Join Date
    Dec 2003
    Location
    Raleigh, NC
    Posts
    44
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    BTW, I was also able to workaround the problem by adding the following line to my .htaccess file but I felt this was only temporary since it eliminated all caching.

    Header set Cache-Control: "no-store, no-cache, must-revalidate, pre-check=0, post-check=0, max-age=0"


Bookmarks

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •