I have a chrome extension which should listen to localStorage
changes in a content script on a given website.
Website sets local storage with window.localStorage.setItem('test', 'test');
I want to bind a listener to storage changes as
$(window).bind('storage', function (e) {
alert('storage changed');
});
But, given code only works when I go to Chrome Inspect > Application > Local Storage
and remove something or add.
I also tried to run a
var test = window.localStorage.setItem('test','test');
just below my binding
still doesn't work.
How can I listen to localStorage changes in this case?