Cached libraries

Discussion in 'Javascript' started by Archos, Feb 11, 2012.

  1. Archos

    Archos Guest

    Does the JavaScripts files dowloaded by the browsers are cached by
    them?

    Web1 uses library Lib1.1.0.js
    Web2 use the same library

    If the user goes to Web1 then he gots that library. Now, the user
    closes the browser, open it again and he goes to Web2. Does
    Lib1.1.0.js is already in her system?

    My doubt is because I want to know if it's really useful to remove
    functions of a library that they are not going to used by your
    program. But if that library is cached, then it isn't better don't
    touch it.
     
    Archos, Feb 11, 2012
    #1
    1. Advertisements

  2. Archos

    Archos Guest

    Any comment about it? Thanks in advance!
     
    Archos, Feb 13, 2012
    #2
    1. Advertisements

  3. Browsers will possibly cache the library on both websites if they
    share the same location:

    Website 1 and website 2 contains:
    <script src="http://example.com/myLib.js">

    This will probably not work:

    Website 1 contains:
    <script src="myLib.js">

    Website 2 contains:
    <script src="myLib.js">

    There was a discussion IIRC involving resource hashing a few years ago
    but I don't think anything came from it. Perhaps someone can recall in
    more detail (and offer a link), but I believe there was a short
    argument between Crockford and Eich on a similar topic.
     
    Michael Haufe (TNO), Feb 13, 2012
    #3
    1. Advertisements

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments (here). After that, you can post your question and our members will help you out.