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");
Published on 10-Apr-2018 12:06:57