firefox - Skip-the-server-cache feature in browsers

24
2013-08
  • msh210

    Years ago, I used Lynx (the Web browser). And it had a neat feature: you could follow a link normally, or you could specify that you wanted a non-cached copy. Regular link loading, or link reloading. As the users' guide for Lynx 2.8.6 says:

    The NOCACHE ('x' or 'X') command can be used in lieu of ACTIVATE (Return or right-arrow) to request an uncached copy and new rendition for the current link, or resubmission of a FORM, if a cache from a previous request or submission exits. The request or submission will include Pragma: no-cache and Cache-Control: no-cache in its headers. Note that FORMs with POST content will be resubmitted regardless of whether the NOCACHE or ACTIVATE command is used....

    This seems such an obvious feature to have — and, as demonstrated, it exists in at least one browser — that it seems surprising to me that Firefox, Chrome, and Microsoft don't seem to have such a feature (say, as a right- (or command-) click menu option). Nor, in fact, does there seem even to be a Firefox extension for it.

    So, my questions:

    1. Is there something blocking implementation of this idea in modern graphical browsers? Some specific reason it can't feasibly exist in them even though it can in Lynx?
    2. Is there some reason this feature is not necessary or desired in modern graphical browsers? If so, does that reason apply to Lynx?
    3. As I mentioned, I couldn't find a Firefox or Chrome extension (or built-in feature) like this. Does one exist that I'm missing?
  • Answers
  • soandos

    My understanding is that when your browser sends a request for a resources the following takes place (roughly):

    1. The browser sends a request for the resource
    2. The server responds with the last time that resource was modified
    3. If that time is later than the version that the browser has cached, the browser downloads the resource again.

    If you want to see this taking place (in not so much detail), open the developer panel in Chrome (using Ctrl+Shift+J), and reload a page. You will see that even for resources that were cached (under size, it will say from cache) there was a request for them.

    Because the browser will update if and only if needed, there is no need to generally force a reload of all of the resources (the exception is if the data somehow gets corrupted, and then clearing the cache may solve the problem).

    So to answer your questions in summary:

    1. Nope
    2. It will mostly hurt, and only very rarely help (see above)
    3. Not that I can find, but if you find this behavior causing errors, you can just clear your cache manually.

    Note: I am not 100% about how items 1 and 2 acutally take place, but something that accomplishes those two things takes place, though the implementation might be differnt.

  • Dan D.

    In at least some of the browsers (IE, Firefox, Chrome, Epiphany) that I know of holding Shift while clicking Refresh (or Shift+F5), forces the browser to ignore the cache and request all resources afresh.

    But you can't invoke this option if the page isn't or wasn't already loaded.


  • Related Question

    cache - Chrome browser caching
  • Kyle B.

    Possible Duplicate:
    How to force refresh without cache in Google Chrome?

    I do a lot of development on my local machine and would like to start using Chrome, however I cannot seem to do a hard-refresh (ctrl+f5) or any other key combination to get my browser to forcibly refresh all content @ http://localhost. I change projects frequently in IIS and this presents a problem because I see stylesheet and image data from my previous project with no way to get this page to reload without forcibly dumping all cache data from the settings menu.

    Is there another key combination I am missing, or is there a place I can (on a site by site basis) turn off caching? I prefer not to have to clear out my temporary files in the browser settings as I switch projects frequently.

    Thanks, Kyle


  • Related Answers
  • Synetech

    Update: This is supported in current versions of Chromium and Chrome.


    No, you are not missing anything. Chromium did not actually support forced-reload until recently.

    Either you can use the latest dev build in which it has been implemented, or you can delete the cache by pressing Ctrl+Shift+Del, then doing a reload. Sorry, no other key-combo or quicker/easier solution.

    (Unofficially, that is, untested, but I have noticed from a year-and-half of use that Chromium tends to pick up new info (eg changes in the HOSTS file, modified files, etc.) if you do a reload after a while, say a couple of minutes, whereas it if you reload right away, it will just use the cached info. So you could try that, but the delay may be more hassle than just emptying the cache.)

  • Sarah

    According to this page, ctrl+F5 should do what you want on Windows. However, there are a lot of bug reports pertaining to it not functioning correctly.

  • desau

    Looks like this has finally been implemented.

    Holding down Shift while accessing the View menu will give you a "Force Reload" option - complete with a hotkey. On Mac, it's Shift-Command-R.

  • lisak

    I think that the best solution is setting up non-writable permissions on the cache stuff

    HERE

  • Tauren

    Another temporary solution until this is fixed in Chrome is to open an Incognito window (ctrl-shift-n). In a new Incognito window, Chrome will not use the cache.

  • Paul Lammertsma

    You might want to try using some sort of CSS caching. I recently decided to fix this using the following approach:

    PHP

    $smarty->assign('css_hash', filesize('style/style.css'));
    

    Smarty

    <link rel="stylesheet" href="/style/style.css?{$css_hash}" type="text/css" />
    

    This will ensure that the browser loads the CSS when the size of the stylesheet changes. You could instead use a timestamp or a proper hash (e.g. MD5), but this fix sufficed for my purpose.