localStorage change events from normal window triggerred on InPrivate window for the same domain

Issue #23929198 • Assigned to Corey W.


Anand R.
Nov 5, 2019
This issue is public.
Found in
  • Microsoft Edge
Reported by 1 person

Sign in to watch or report this issue.

Steps to reproduce

I am seeing an unexpected behavior w.r.t localStorage change events. I have page which registers for change events like this
$(window).on('storage’, onStateChange);

Steps to reproduce

  1. Open the page in Edge(normal mode) – It has its own localStorage.
  2. Now open a new window in incognito(InPrivate) mode – New window has its own localStorage and can login as different user as expected.
  3. Pages on both windows are listening for localStorage change events.
  4. Any values that are put in localStorage on normal window, only get stored in it’s own local storage and not seen by InPrivate window(same domain). That is also expected.
  5. But any localStorage operations that are done on normal window, triggers an event on the incongnito mode window, which is strange. Vice versa is not true, i.e. localStorage operations on incognito window do not trigger any event on normal window.

I don’t see this behavior on IE/Firefox/Chrome. i.e. localStorage operations do not trigger any event on window with incognito mode. I think that is how it should be.

Is there a known issue with Edge?


0 attachments

    Comments and activity

    • Microsoft Edge Team

      Changed Assigned To to “Corey W.”

    • Hello,

      We sincerely
      appreciate your feedback. Currently, we are having difficulty reproducing the reported issue because of syntax errors in the expression you included in your original message. 
      o investigate
      this issue further, could you please provide us sample code, Jsbin.com link, or html page that contains the code that is not behaving as you believe it should.

      This will
      help our investigation and allow us to compare apples to apples.


      The MS Edge

    • Thanks for checking. I cannot share the entire page, but this is what we do.

      We register for localStorage events to capture any changes to items put/deleted on it.

      $(window).on('storage’, onStateChange);

      function onStateChange (ev) {
      var storageKey = ev.originalEvent.key;
      var storageKeyValue = ev.originalEvent.newValue;
      //In case value is null, we are not acting on it. So ignore it.
      console.log("Key Recieved"+ storageKey + “=” + storageKeyValue);

      We are receiving events on the InPrivate window when something put on normal window, which I believe is not expected. This doesn’t happen on IE/firefox/chrome.

    • Forgot to mention, we registering for events so that changes to localStorage get propagated to other tab of the same normal window. We do receive events on the other tab which is expected but events getting delivered to InPrivate window (with same domain) as well which is not expected.

    You need to sign in to your Microsoft account to add a comment.

    Sign in