localStorage doesn't clear when the browser exits so it's a security issue in some cases. Look at sessionStorage instead in that case.
Inter-window messaging using localStorage
11–20 of 30 posts
Re: Inter-window messaging using localStorage
#12Earlier quoted context omitted.
I am disappointed I did not have an original thought. Nothing is new in this world. I propose we rename it the "Web Storage And Messaging" API.
Don't be disappointed! This is slick, and easy to understand. I don't really want to digest the javascript Facebook is using to learn a new tool/concept.
Re: Inter-window messaging using localStorage
#13localStorage doesn't clear when the browser exits so it's a security issue in some cases. Look at sessionStorage instead in that case.
Re: Inter-window messaging using localStorage
#14Great idea. Doesn't seem to work in Chrome on iOS?
I was intending this to be a "nice to have if it works", rather than essential to my app. But do people really use multiple tabs on a single site that much on mobile devices?
Re: Inter-window messaging using localStorage
#15This isn't abuse, it's what the storage event was specifically made for. Facebook, Google, etc. have been using this event to update common state information between tabs for quite a while.
I am disappointed I did not have an original thought. Nothing is new in this world. I propose we rename it the "Web Storage And Messaging" API.
Re: Inter-window messaging using localStorage
#16localStorage doesn't clear when the browser exits so it's a security issue in some cases. Look at sessionStorage instead in that case.
Could you use sessionStorage to hold a temporary key for decrypting whatever is localStorage?
Re: Inter-window messaging using localStorage
#17If you want to use localStorage atomically, I found this writeup and code on a LockableStorage interface to be very thorough: http://balpha.de/2012/03/javascript-concurrency-and-locking-...
Note that the way Chromium implements localStorage, it uses a disk backing store of sqlite, a caching layer (a std::map) in the browser process, and a caching layer (also a std::map) in the renderer processes (where WebKit runs, and may handle 1-X tabs per process). Changes are propagated via IPC, but as the API does not provide any locking guarantees beyond the optional storage mutex, which Chromium does not implement, there are obviously race conditions.
This probably explains the issues the author of that post encountered with Chrome.
Re: Inter-window messaging using localStorage
#18If you want to use localStorage atomically, I found this writeup and code on a LockableStorage interface to be very thorough: http://balpha.de/2012/03/javascript-concurrency-and-locking-...
It depends on what you mean by atomic. Please refer to http://www.chromium.org/developers/design-documents/indexedd... where Chromium devs state: """ LocalStorage is inherently racy or a parallelism disaster, depending on whether or not you're willing to implement the "storage mutex" described in the spec. Chromium has decided not to implement it. WebKit itself is single thread/process (i.e. no parallelism period). "…
Re: Inter-window messaging using localStorage
#19Re: Inter-window messaging using localStorage
#20Earlier quoted context omitted.
I am disappointed I did not have an original thought. Nothing is new in this world. I propose we rename it the "Web Storage And Messaging" API.
Maybe you didn't invent the idea, but your post will likely introduce the concept to many folks. I believe this is equally valuable. Thanks.