Skip to content Skip to sidebar Skip to footer

How To Push Oath Token To Localstorage Or Localsession And Listen To The Storage Event? (soundcloud Php/js Bug Workaround)

This references this issue: Javascript SDK connect() function not working in chrome I asked for more information on how to resolve with localstorage and was asked to create a new t

Solution 1:

You can attach an event listener to the "storage" event which is fired by the window.

window.addEventListener("storage", myHandler, false);

The handler is passed an event object which includes the key which changed.

function myHandler(event) {
   if (event.key === 'the_oauth_token') {
       // do something with it
   }
}

Here's a demo: http://html5demos.com/storage-events

Post a Comment for "How To Push Oath Token To Localstorage Or Localsession And Listen To The Storage Event? (soundcloud Php/js Bug Workaround)"