3

I am looking for a way to store almost all JS & CSS in localstorage. I know how to do it with CSS (seems to work without a hitch). However, if you try to store JS that has any HTML call like that will stop the saving to the local storage. Ideally I would just like to create a list of source files for the browser to download.

To give you an idea I am trying to store the Jquery UI js and Jquery in local storage. This way they only need be loaded once.

Doing this will drastically improve the speed of my application. I have already built in version control so that I can overwrite any old data.

one more thing....just to make it fun...I need a callback once everything has been downloaded so I can forward the user. (any ideas on how to do this?)

thanks all for any help!!!

6
  • possible duplicate of Storing Objects in HTML5 localStorage Commented Jun 10, 2011 at 0:12
  • 4
    This is pointless when you use correct caching Commented Jun 10, 2011 at 0:12
  • Please explain proper caching then. Commented Jun 10, 2011 at 0:18
  • Proper caching would be setting your Expires headers for your content. developer.yahoo.com/performance/rules.html#expires This is better because you are leveraging a proven methodology, works for all browsers and allows the content to be cached by intermediary servers. Also, 1MB of assets seems high. Compress and minify your assets if you aren't already. developer.yahoo.com/yslow/help/#guidelines Commented Jun 10, 2011 at 1:52
  • This is an application. If you look at Jquery UI and Jquery lib. they are about .5mb if you make use of everything. All assets include quite a bit of things from config files, css, and js. The site has over a hundred pages. I am just trying to make use of localStorage. I really don't feel caching is the best way. I am trying to make use of newer methods...does everyone believe caching is the best method? Commented Jun 10, 2011 at 3:49

1 Answer 1

1

the browser should cache those resources, so storing them in localstorage isn't worth the headache.

Sign up to request clarification or add additional context in comments.

1 Comment

well I am going to store almost all assets. If assets are up-to-date then they are only loaded 1 time. Since this is a web application the first time they come to the site everything is loaded which is about 1mb of assets. After that they are no longer needed and they pull from local storage and they aren't deleted when cache is. I happen to like this option but I am open to other suggestions.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.