Bug with Chrome's localStorage implementation? explains very well the spec, and how it behaves differently in Opera and IE9.
But, now what?
That will really mess up my code (any code) that relies on the implementation to be one way on a browser, when it's another.
How do I test to know whether the event is firing on the window that invokes it or not?
The only thing I can figure is to use a setTimeout()
to wait and see if the event is firing in the window that calls it or not, and then do something if it doesn't. But, that can make some terrible bugs when the storage event is called in quick succession.
In my case I need the event firing for all windows, not all but the one calling it. In Chrome that implements it to the spec correctly this is just a matter of adding an extra function after adding to the localStorage.setItem()
, but then in IE, Firefox3.6 and Opera it's going to effectively do that twice. I could also have different code based on browser, but I should be testing for compatibility not browser version.
Is there a way to "patch" all browsers with localStorage
support to have the event handled the same way on them all?