Open daGrevis opened 12 years ago
It can store 5MB - for IE its 10MB. And anyone who is serving 5MB of any type of file has bigger performance issues to think about than page caching..
2.5 MB should be a good limit for localstorage.
You could find the remaining storage amount with this function
function remainingLocalStorageSpace(){
return 25e5 - JSON.stringify(localStorage).length;
}
Local Storage does have space restrictions, however if for any reason BootUp can't use Local Storage it'll work just fine without it. BootUp goes for the all-or-nothing approach - if it can't store one file, then it won't store any (due to the way that it stores it in localStorage).
As mentioned above, the limit is roughly 5MB in most web browsers. There are some gotcha's with the iPhone/iPad though (if the user is using private browsing, you have no local storage available to use). These bases should all be covered in the current implementation.
Another thought.... why we need to use this when browsers save loaded-up files in cache anyway?
If you have your caching policies set correctly (i.e. non-expiring static files) then that will be fine for desktop browsers.
Unfortunately, mobile browsers, particularly iOS Safari, have in-memory caches. This means that everything gets forgotten rather quickly, or when the user hard quits the app or restarts their phone. This was designed for mobile websites to help them, which is why this came about.
The situation is better on Android with Chrome, as it does have a persistent disk cache that's variable based on the amount of space available on the device.
Here's a good article explaining how mobile browsers cache: http://www.webperformancetoday.com/2012/07/12/early-findings-mobile-browser-cache-persistence-and-behaviour/
still not getting how this is different than an app cache manifest file. It's more dynamic for sure, but in most use cases static files in the manifest are handled superbly by browsers. and for dynamic data you have local storage as databases or cookies. What am I missing. BTW 5 megs is plenty fir most cases . Nintendo used to put whole game in less than that.
That is interesting for me as well. AppCache is bad in that if you change a js or css file, AppCache will happily ignore that and keep using the cached copy (effectively breaking markup from non-cached files) unless you actually change the manifest file itself. I was wondering if bootup.js is the solution to this..
On 7 November 2012 15:14, Agustín Amenabar notifications@github.com wrote:
still not getting how this is different than an app cache manifest file. It's more dynamic for sure, but in most use cases static files in the manifest are handled superbly by browsers. and for dynamic data you have local storage as databases or cookies. What am I missing. BTW 5 megs is plenty fir most cases . Nintendo used to put whole game in less than that.
— Reply to this email directly or view it on GitHubhttps://github.com/TradeMe/bootup.js/issues/4#issuecomment-10151531.
Christos Constantinou Web and mobile applications developer
Follow me on: twitter http://twitter.com/christosconst, githubhttp://github.com/snez, blog http://christos.constantinou.com.cy/, stack overflowhttp://stackoverflow.com/users/451989/snez
Simpleweb Ltd, http://simpleweb.co.uk, Tel: 0117 922 0448 Unit G, Albion Dockside Building, Hanover Place, Bristol, BS1 6UThttp://www.google.com/maps?f=q&source=s_q&hl=en&geocode=&q=+BS8+2BG&sll=51.437047,-2.611704&sspn=0.007263,0.011823&ie=UTF8&hq=&hnear=Bristol,+Avon+BS1+6UT,+United+Kingdom&t=h&z=16
Simpleweb Ltd. is registered in England. Registration no: 5929003 : V.A.T. registration no: 891600913
Also here's a list of known mobile browsers that have implemented AppCache http://caniuse.com/#feat=offline-apps
On 7 November 2012 15:23, Christos Constantinou chris@simpleweb.co.ukwrote:
That is interesting for me as well. AppCache is bad in that if you change a js or css file, AppCache will happily ignore that and keep using the cached copy (effectively breaking markup from non-cached files) unless you actually change the manifest file itself. I was wondering if bootup.js is the solution to this..
On 7 November 2012 15:14, Agustín Amenabar notifications@github.comwrote:
still not getting how this is different than an app cache manifest file. It's more dynamic for sure, but in most use cases static files in the manifest are handled superbly by browsers. and for dynamic data you have local storage as databases or cookies. What am I missing. BTW 5 megs is plenty fir most cases . Nintendo used to put whole game in less than that.
— Reply to this email directly or view it on GitHubhttps://github.com/TradeMe/bootup.js/issues/4#issuecomment-10151531.
Christos Constantinou Web and mobile applications developer
Follow me on: twitter http://twitter.com/christosconst, githubhttp://github.com/snez, blog http://christos.constantinou.com.cy/, stack overflowhttp://stackoverflow.com/users/451989/snez
Simpleweb Ltd, http://simpleweb.co.uk, Tel: 0117 922 0448 Unit G, Albion Dockside Building, Hanover Place, Bristol, BS1 6UThttp://www.google.com/maps?f=q&source=s_q&hl=en&geocode=&q=+BS8+2BG&sll=51.437047,-2.611704&sspn=0.007263,0.011823&ie=UTF8&hq=&hnear=Bristol,+Avon+BS1+6UT,+United+Kingdom&t=h&z=16
Simpleweb Ltd. is registered in England. Registration no: 5929003 : V.A.T. registration no: 891600913
Christos Constantinou Web and mobile applications developer
Follow me on: twitter http://twitter.com/christosconst, githubhttp://github.com/snez, blog http://christos.constantinou.com.cy/, stack overflowhttp://stackoverflow.com/users/451989/snez
Simpleweb Ltd, http://simpleweb.co.uk, Tel: 0117 922 0448 Unit G, Albion Dockside Building, Hanover Place, Bristol, BS1 6UThttp://www.google.com/maps?f=q&source=s_q&hl=en&geocode=&q=+BS8+2BG&sll=51.437047,-2.611704&sspn=0.007263,0.011823&ie=UTF8&hq=&hnear=Bristol,+Avon+BS1+6UT,+United+Kingdom&t=h&z=16
Simpleweb Ltd. is registered in England. Registration no: 5929003 : V.A.T. registration no: 891600913
I see where you come from, and for that it's pretty useful, updating app cache is pretty cumbersome. App cache and webStorage share the limit on storage. The only thing is that if you care for performance, going the native way is generally the safest bet, though you'd only be replacing the download of a .appcache file for the bootup.js file. I'll give it a go next time I'm dealing with local caching. The LGPL licence just kills me.
AppCache manifests have many gotchas that can catch you out if you're not careful (for example, if you have set your manifest file to never expire then your users will never get an updated version). BootUp.js at least lets you manage it a bit better.
Also, with AppCache manifests, if one file changes, it will dump the entire cache and redownload everything again (BootUp only updates the files that have changed).
I guess the best explanation about using local storage over appcache is from this video from FTLabs: http://www.youtube.com/watch?feature=player_detailpage&v=iZA4t5MmRBY#t=1034s
In general, appcache is great for files that don't change that often, while localstorage is great for things that do.
This discussion would make some good points in the documentation
On 7 November 2012 22:34, Daniel McKenzie notifications@github.com wrote:
AppCache manifests have many gotchas that can catch you out if you're not careful (for example, if you have set your manifest file to never expire then your users will never get an updated version). BootUp.js at least lets you manage it a bit better.
Also, with AppCache manifests, if one file changes, it will dump the entire cache and redownload everything again (BootUp only updates the files that have changed).
I guess the best explanation about using local storage over appcache is from this video from FTLabs:
http://www.youtube.com/watch?feature=player_detailpage&v=iZA4t5MmRBY#t=1034s
In general, appcache is great for files that don't change that often, while localstorage is great for things that do.
— Reply to this email directly or view it on GitHubhttps://github.com/TradeMe/bootup.js/issues/4#issuecomment-10168157.
Christos Constantinou Web and mobile applications developer
Follow me on: twitter http://twitter.com/christosconst, githubhttp://github.com/snez, blog http://christos.constantinou.com.cy/, stack overflowhttp://stackoverflow.com/users/451989/snez
Simpleweb Ltd, http://simpleweb.co.uk, Tel: 0117 922 0448 Unit G, Albion Dockside Building, Hanover Place, Bristol, BS1 6UThttp://www.google.com/maps?f=q&source=s_q&hl=en&geocode=&q=+BS8+2BG&sll=51.437047,-2.611704&sspn=0.007263,0.011823&ie=UTF8&hq=&hnear=Bristol,+Avon+BS1+6UT,+United+Kingdom&t=h&z=16
Simpleweb Ltd. is registered in England. Registration no: 5929003 : V.A.T. registration no: 891600913
I agree, adding a short when and why this should be used instead of app cache to the readme would be nice. Or a link to this thread would be enough.
As to the manifest, I wasn't sure the browser downloaded everything again if the app cache manifest changed. So bootup.js does make much more sense for assets that change often in opposition to the appcache manifest which generally is better left for last, when you have a clear list of static files.
The video is brilliant! the optimizations are great. Just got a lot smarter for seeing it.
That's a great idea, I'll try add something tonight UK time. On 8 Nov 2012 11:23, "Agustín Amenabar" notifications@github.com wrote:
I agree, adding a short when and why this should be used instead of app cache to the readme would be nice. Or a link to this thread would be enough.
As to the manifest, I wasn't sure the browser downloaded everything again if the app cache manifest changed. So bootup.js does make much more sense for assets that change often in opposition to the appcache manifest which generally is better left for last, when you have a clear list of static files.
The video is brilliant! the optimizations are great. Just got a lot smarter for seeing it.
— Reply to this email directly or view it on GitHubhttps://github.com/TradeMe/bootup.js/issues/4#issuecomment-10184345.
Isn't localStorage somehow limited? I mean, I think it can't store more than few kilobytes...