4

Is there a way to use JavaScript to dynamically inject files into the applicationCache? I have seen some references to an applicationCache.add() function, but I can't find any documentation for it and it doesn't exist on the window.applicationCache object in my testing with Chrome.

I have a web application I'm working on that based on a decision needs to inject files into applicationCache. Unfortunately this application doesn't have a traditional server-side component (it's basically static files and JS that communicates with a data source), so I can't just create a dynamic manifest file using something like PHP.

Is there any way to do this?

Thanks!

2
  • You could use localStorage instead to store the file contents, then then use them as resources from there using Data URIs. Commented May 7, 2014 at 18:45
  • 1
    The add() method your hear about is not part of the HTML5 Offline Applications specifications at all. It seems it is an internal method used by the Chrome engine in Firefox. Commented Feb 17, 2015 at 9:27

1 Answer 1

1

How you can read below, doesn't exist an applicationCache.add() function, you can only update your manifest, so invalidate the cache

reference

[Exposed=Window,SharedWorker]
interface ApplicationCache : EventTarget {

  // update status
  const unsigned short UNCACHED = 0;
  const unsigned short IDLE = 1;
  const unsigned short CHECKING = 2;
  const unsigned short DOWNLOADING = 3;
  const unsigned short UPDATEREADY = 4;
  const unsigned short OBSOLETE = 5;
  readonly attribute unsigned short status;

  // updates
  void update();
  void abort();
  void swapCache();

  // events
           attribute EventHandler onchecking;
           attribute EventHandler onerror;
           attribute EventHandler onnoupdate;
           attribute EventHandler ondownloading;
           attribute EventHandler onprogress;
           attribute EventHandler onupdateready;
           attribute EventHandler oncached;
           attribute EventHandler onobsolete;
};
Sign up to request clarification or add additional context in comments.

Comments

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.