• Visitors can check out the Forum FAQ by clicking this link. You have to register before you can post: click the REGISTER link above to proceed. To start viewing messages, select the forum that you want to visit from the selection below. View our Forum Privacy Policy.
  • Want to receive the latest contracting news and advice straight to your inbox? Sign up to the ContractorUK newsletter here. Every sign up will also be entered into a draw to WIN £100 Amazon vouchers!

Browser caching

Collapse
X
  •  
  • Filter
  • Time
  • Show
Clear All
new posts

    Browser caching

    It's all very wierd, I uploaded a widened webpage this morning and IE9 opened it at correct width but with all the old images! Had to refresh to make it look right. Chrome just loaded the old page. Apart from renaming everything on every update, (not a solution for the index page anyway) how do you stop browsers caching so that users see new content REALLY? What are our customers actually seeing?

    I've got all the pragma no cache stuff in the header but, as some things on the net say, those don't always work. Looked at htaccess and some links say you shouldn't use that either as it slows the site down, so at bit of a loss.

    Never recall this problem before a year or two ago, you just updated a page and there it was. Any brill ideas in language for webby dimwits or comprehensible links appreciated.
    bloggoth

    If everything isn't black and white, I say, 'Why the hell not?'
    John Wayne (My guru, not to be confused with my beloved prophet Jeremy Clarkson)

    #2
    Originally posted by xoggoth View Post
    It's all very wierd, I uploaded a widened webpage this morning and IE9 opened it at correct width but with all the old images! Had to refresh to make it look right. Chrome just loaded the old page. Apart from renaming everything on every update, (not a solution for the index page anyway) how do you stop browsers caching so that users see new content REALLY? What are our customers actually seeing?

    I've got all the pragma no cache stuff in the header but, as some things on the net say, those don't always work. Looked at htaccess and some links say you shouldn't use that either as it slows the site down, so at bit of a loss.

    Never recall this problem before a year or two ago, you just updated a page and there it was. Any brill ideas in language for webby dimwits or comprehensible links appreciated.
    Can you not set a page to expire?

    Code:
    <HEAD>
    <TITLE>---</TITLE>
    <META HTTP-EQUIV="Pragma" CONTENT="no-cache">
    <META HTTP-EQUIV="Expires" CONTENT="-1">
    </HEAD>
    Originally posted by Stevie Wonder Boy
    I can't see any way to do it can you please advise?

    I want my account deleted and all of my information removed, I want to invoke my right to be forgotten.

    Comment


      #3
      Thanks but yes, I've got exactly that in all my headers. No idea why it seems to do nowt.
      bloggoth

      If everything isn't black and white, I say, 'Why the hell not?'
      John Wayne (My guru, not to be confused with my beloved prophet Jeremy Clarkson)

      Comment


        #4
        Originally posted by xoggoth View Post
        Thanks but yes, I've got exactly that in all my headers. No idea why it seems to do nowt.
        Not all browsers honour them, those that don't will be looking at the HTTP headers, so you really need to set the HTTP Cache-Control header.
        While you're waiting, read the free novel we sent you. It's a Spanish story about a guy named 'Manual.'

        Comment


          #5
          Originally posted by xoggoth View Post
          It's all very wierd, I uploaded a widened webpage this morning and IE9 opened it at correct width but with all the old images! Had to refresh to make it look right. Chrome just loaded the old page. Apart from renaming everything on every update, (not a solution for the index page anyway) how do you stop browsers caching so that users see new content REALLY? What are our customers actually seeing?

          I've got all the pragma no cache stuff in the header but, as some things on the net say, those don't always work. Looked at htaccess and some links say you shouldn't use that either as it slows the site down, so at bit of a loss.

          Never recall this problem before a year or two ago, you just updated a page and there it was. Any brill ideas in language for webby dimwits or comprehensible links appreciated.
          Sorry to state the obvious, but the easiest way of getting around this problem is to simply update the file paths of the images you're having trouble presenting new versions of. The simplest way to achieve that is to place all images in a folder that reflects the date and time of updating the website, e.g. "images_20120703_2024". Then, it's a simple matter of using find and replace to update every reference to the old versions in your newly-published project. This means that your consumers will still be able to benefit from caching, but in a way that allows you to later update your content at any time you want, without you having to play Mystic Meg at the time of publication by trying to predict when you might next want to update the site. And, as you observed, some browsers don't respect expiry date HTTP headers anyway, making that solution unviable for a public-facing website that needs to cater to a range of browsers and browser versions.
          Last edited by Gentile; 3 July 2012, 19:34.

          Comment


            #6
            Cheers. Beginning to think that renaming on every update is the only real solution but is changing the image path on its own any good if they are still viewing the old HTML with the old image path? Surely have to change all names and paths? And how change index.html? index.htm or index.php should work but is good for only two updates.

            This caching stuff (unless it actually worked properly) is insane.
            Last edited by xoggoth; 3 July 2012, 20:11.
            bloggoth

            If everything isn't black and white, I say, 'Why the hell not?'
            John Wayne (My guru, not to be confused with my beloved prophet Jeremy Clarkson)

            Comment


              #7
              Originally posted by xoggoth View Post
              Cheers. Beginning to think that renaming on every update is the only real solution but is changing the image path on its own any good if they are still viewing the old HTML with the old image path? Surely have to change all names and paths? And how change index.html? index.htm or index.php should work but is good for only two updates.

              This caching stuff (unless it actually worked properly) is insane.
              You said the widths on the page presented were correct, but that the images were wrong. So that must mean you had the caching directives that others have mentioned set correctly on the previous version of your site. It's only the browser-specific caching of images that appears to be proving a problem. (NB: if you hadn't set HTML caching directives correctly previously, it'd be a Tardis you'd need to fix the problem at this juncture, and not a redesign, since the previous version of your site would remain cached on your consumers' browsers no matter what you did now). Fortunately your previous version can't have had markup that would cause your recent HTML changes to be ignored by the sound of it, it's only ignoring updates to images for some reason, and so just renaming the folder referenced should work.
              Last edited by Gentile; 3 July 2012, 20:31.

              Comment


                #8
                Cheers! Yes but as said that was IE doing that, it was the old version of the whole page in Chrome. Lot of people have this problem in Chrome apparently. Also, just browsing through several sites at random on Google, did not find a single occurence of <META HTTP-EQUIV in any headers. This is what is really puzzling about the whole thing.

                PS You should buy a really cheap old Chinese made CCTV. Once you figure out what the instructions should be, they work great!
                Last edited by xoggoth; 3 July 2012, 22:23.
                bloggoth

                If everything isn't black and white, I say, 'Why the hell not?'
                John Wayne (My guru, not to be confused with my beloved prophet Jeremy Clarkson)

                Comment


                  #9
                  What web server are you running on?

                  Comment


                    #10
                    Would changing it from .html to .php or something help?
                    Originally posted by MaryPoppins
                    I'd still not breastfeed a nazi
                    Originally posted by vetran
                    Urine is quite nourishing

                    Comment

                    Working...
                    X