javascript - How to dynamically Update a text-box in a different page when the value changed using Local Storage? -


assume have 2 web pages. in page a, have button change value in local storage follows.

localstorage.setitem('key', key); 

this key random string generated when button click. therefore each time when button clicked change localstorage value. in page b have textbox should dynamically change value when value of key in local storage changed.

it should happen when have opened 2 pages in 2 tabs in browser.

can use event listener that? if how implement ?

 $(window).bind('storage', function (e) {       console.log(e.originalevent.key, e.originalevent.newvalue);  }); 

this trick


Comments

Popular posts from this blog

Magento/PHP - Get phones on all members in a customer group -

php - Bypass Geo Redirect for specific directories -

php - .htaccess mod_rewrite for dynamic url which has domain names -