Execute a script when a Web Storage area is updated in HTML?


Use the onstorage attribute in HTML to execute on Web Storage area update. You can try to run the following code to implement onstorage attribute −

Example

<!doctype html>
<html>
   <head><title>HTML onstorage</title>
   </head>
   
   <body>
      <h2>Welcome</h2>
      <body onstorage = "javascript:alert('Your learning journey!');">
      Demo text</body>
   </body>
</html>

Updated on: 30-Jul-2019

81 Views

Kickstart Your Career

Get certified by completing the course

Get Started
Advertisements