Welcome to TalkGraphics.com
Page 1 of 2 12 LastLast
Results 1 to 10 of 16
  1. #1

    Default Workaround so site viewers don't need to clear cache on update?

    Hey everyone, my new site has been up for about a week now.

    We plan on having a few things change every week and other things would be updated too.

    But a problem I have been confronted with is that in order to see the new change properly, the browser's cache needs to be cleared. And I can't expect every viewer to do that every time they visit the site.

    What is it that other web masters do to prevent this? Is there a script that forces the browsers cache for that particular website to be cleared upon entry/exit?

  2. #2

    Default Re: Workaround so site viewers don't need to clear cache on update?

    By default, people viewing your site(s) should load the new version during a new session. If a change is made while they are viewing the site, then their cache may be an issue. But in general it isn't an issue.

    This is more a development "problem" as one is creating the site than people out on the web. Intrawebs can sometimes have caching issues. But, in general, not Internet users.

    Take care, Mike

  3. #3
    Join Date
    Jul 2011
    Location
    The Treasure Coast of Florida
    Posts
    26

    WD6 Re: Workaround so site viewers don't need to clear cache on update?

    There is a refresh tag you should look into.

    <meta http-equiv="refresh" content="600">

    Do a search...it might be exactly what you need to assure refreshing the page.

  4. #4

    Default Re: Workaround so site viewers don't need to clear cache on update?

    The refresh tag will simply refresh the page on every visit at whatever time interval one chooses. Not a good methodology for typical visitors on typical web sites. It can be annoying if there isn't content on dynamic pages needing updated every X seconds (think stock tickers and other real-time needs).

    Mike

  5. #5
    Join Date
    Nov 2009
    Location
    Near Spokane, WA, USA
    Posts
    41

    Default Re: Workaround so site viewers don't need to clear cache on update?

    I've experienced the same issue - when the updated site is republished, the image names will likely be scrambled so that, for example, 35.jpg is now a different image and when the site is revisited, the cached 'old' 35.jpg will load in place of the updated image, and things will look strange indeed.

    In most cases, a simple refresh will fix the issue, though it's not something I'd be happy to put clients or customers through...

    But in some cases, like image galleries, refresh won't clear the problem, and the only way to correct things is to clear the cache.

    I've tried various strategies of adding 'no-cache' meta tags, but they don't seem to touch the issues that require a cache wipe.

    Has anyone come up with something that works?

  6. #6
    Join Date
    Mar 2009
    Location
    England
    Posts
    2,044

    Default Re: Workaround so site viewers don't need to clear cache on update?

    "Re-publish changed files only" should solve most problems. Works in XDP7 and I think XDP6. Not sure which other ones had this facility.

    Closing and reopening the browser will usually be enough to clear out the old data so that in normal use your visitors will see the page as intended.
    Attached Thumbnails Attached Thumbnails Click image for larger version. 

Name:	RePublish.jpg 
Views:	97 
Size:	44.0 KB 
ID:	84134  

  7. #7
    Join Date
    Aug 2010
    Posts
    533

    Default Re: Workaround so site viewers don't need to clear cache on update?

    I got this from StackOverflow


    <script>
    function pageLoaded()
    {
    alert("load event handler called.");
    }
    function pageUnloaded()
    {
    alert("unload event handler called.");
    }
    window.addEventListener("load", pageLoaded, false);
    window.addEventListener("unload", pageUnloaded, false);
    </script>


    The code needs to be placed in the <head> section of your page. You can remove the alerts they are there to show you it works. 1st alert is when the page loads the 2nd is when the page unloads from the cache
    Last edited by jamesd; 15 September 2011 at 09:16 PM.

  8. #8
    Join Date
    Sep 2000
    Location
    Bracknell, UK
    Posts
    8,659

    Default Re: Workaround so site viewers don't need to clear cache on update?

    James, I don't see the relevance of that javascript for subverting the cache.

  9. #9
    Join Date
    Aug 2010
    Posts
    533

    Default Re: Workaround so site viewers don't need to clear cache on update?

    This is the Thread in StackOverflow I am referring to
    http://stackoverflow.com/questions/1...he-back-button

    I don't know much about java script, maybe I am reading into it too much?

  10. #10
    Join Date
    Sep 2000
    Location
    Bracknell, UK
    Posts
    8,659

    Default Re: Workaround so site viewers don't need to clear cache on update?

    It's about doing "something" when the page is loaded into the browser or when the page is going to change, so it doesn't really have any effect on the cache. the code doesn't care whether the page is loaded from the cache or a web server.

 

 

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
  •