localStorage cross window events ios7 does not trigger

588 Views Asked by At

I need to communicate data between two windows on the same domain, this question might have some resemblance to this, but I have a specific problem with ios.

I have landed on trying this localStorage event message workaround as suggested in one of the answers to the question mentioned earlier.

var input = document.getElementById("text");
var output = document.getElementById("textout");
input.addEventListener("keyup", function(){
   window.localStorage.setItem("AddedUser", input.value);
});

window.addEventListener("storage", function(event){
  output.innerHTML = window.localStorage.getItem("AddedUser");
}, true);

This code as demonstrated in this fiddle, display what other tabs/windows have as a value in the inputfield. This works perfectly in chrome, safari and firefox on my mac as well as chrome and default browser on my Android. (Try it by opening two tabs with the fiddle, and type something in the inputfield, then switch tab and see that the content of "#textout" has changed.)

However, this does not work in ios7 (sorry I have not been able to test on anything older), nothing happens both in chrome and safari. I would have debugged this if I had an apple device, but unfortunately the devices I have tested this on is not mine, so I need some help here.

Does anyone know why this is happening/not happening?

0

There are 0 best solutions below