Javascript DOM StorageEvent url Property

Introduction

The Storage Event is triggered when there is a change in the window's storage.

The storage event is only triggered when a window other than itself makes the changes.

The url property belongs to the Storage Event object.

It returns the url of the page where the item was changed.

View in separate window

<!DOCTYPE html>
<html>
<body>
<p>The url of the page where the item was changed:</p>
<p id="demo"></p>
<script>
window.addEventListener("storage", myFunction);

function myFunction(event) {/* ww w  .j a  va  2s  . com*/
  x = event.url;
  document.getElementById("demo").innerHTML = x;
}
</script>
<iframe src="test_local_storage.htm" style="display:none"></iframe>
</body>
</html>

The url property returns the url of the page where the storage item was changed.




PreviousNext

Related