HTML5 / JS storage event handler

JavascriptWeb DevelopmentFront End Scripts

Storage event handlers only fire if the storage event triggered by another window. You can try to run the following code:

// event handler
window.addEventListener('storage', storageEventHandlerFunc, false);

function storageEventHandlerFunc(evt) {
   alert("Storage event called key: " + event.key );
      case 'one':
      case 'two': batteryDCMeter(); break;
      case 'extPowerOn': rechargeBattery(); break;
sessionStorage.setItem("someKey", "someValue");
Updated on 28-Jan-2020 09:21:54