Computer >> Computer tutorials >  >> Programming >> HTML

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>