How to bind to localStorage change event using jQuery for all browsers?

Posted by David Glenn on Stack Overflow See other posts from Stack Overflow or by David Glenn
Published on 2011-01-12T17:26:25Z Indexed on 2011/01/12 17:54 UTC
Read the original article Hit count: 277

Filed under:
|

How do I bind a function to the HTML5 localStorage change event using jQuery?

$(function () {

  $(window).bind('storage', function (e) {
    alert('storage changed');
  });

  localStorage.setItem('a', 'test');

});

I've tried the above but the alert is not showing.

Update: It works in Firefox 3.6 but it doesn't work in Chrome 8 or IE 8 so the question should be more 'How to bind to localStorage change event using jQuery for all browsers?'

© Stack Overflow or respective owner

Related posts about jQuery

Related posts about html5