1

I am trying to troubleshoot this by capturing any storage events that remove values from local storage. I have an always open dummy page that begins an event listener on load as such:

window.addEventListener("storage", function (evt) { if (evt.newValue == null || (evt.oldValue != "" && evt.newValue == "")) {alert(evt.url);} });

The listener fires just fine. That is not the issue. My issue is that the alert(evt.url) returns "undefined" in mobile browsers. Works just fine on Chrome.

The device is the Samsung Galaxy Tab running Gingerbread OS. The browsers are Dolphin HD and the stock webkit browser.

Edit: Tried it on the iPhone and all works just fine on Safari. Also, the problem only seems to pertain to the url attribute. oldValue, newValue and key all return values.

Brian Tompsett - 汤莱恩
  • 5,753
  • 72
  • 57
  • 129
jmease
  • 2,507
  • 5
  • 49
  • 89
  • I think it's a browser specific issue. I really don't see any way how you'll be able to workaround this problem. Notify me if you do find a solution. – Aadit M Shah Nov 15 '11 at 16:02

1 Answers1

1

As far as I understand Web Storage Events have very limited adoption rate among browsers, most of the implementation to date are partial with only Opera (and Chrome) coming close to the W3C standard. See Wikipedia and this Blog post.

I dont think it is very far fetched that while desktop versions of Chrome support 'events' in Web Storage (somewhat), the functionality has not been ported to most Android devices which rely on system updates (rather than through the app market) to keep their browsers updated.

Steven de Salas
  • 20,944
  • 9
  • 74
  • 82
  • Thank you. That answer was very clear and thoughtful. I will try to track down the missing localStorage issue some other way. – jmease Nov 18 '11 at 20:11