Javascript examples for Browser Object Model:Window localStorage
Access localstorage event across tabs
<html> <head> <title>Tab1</title> </head> <body> <button id="add" onclick="localStorage.setItem('tab','changed')">Add</button> <button id="clear" onclick="localStorage.clear()">Clear</button> <script type="text/javascript"> function onStorageEvent() {// w w w . j a v a2s. c om console.log("storage event: " + localStorage.getItem("tab")); } window.addEventListener('storage', onStorageEvent); </script> </body> </html>