-1

Can anyone help me to know how i can clear sessionStorage before my HTML onload event call? I want to clear al the data stored in sessionStorage before my html rendered

Ashish Chauhan
  • 486
  • 2
  • 8
  • 22
  • 1
    Duplicate of http://stackoverflow.com/questions/2920129/can-i-run-javascript-before-the-whole-page-is-loaded – M3ghana Jan 24 '17 at 10:21
  • Possible duplicate of [Can I run javascript before the whole page is loaded?](http://stackoverflow.com/questions/2920129/can-i-run-javascript-before-the-whole-page-is-loaded) – Rajesh Jan 24 '17 at 10:25

1 Answers1

1

Just run the sessionStorage.clear() before the entiry HTML:

<html>
    <head>
        <script>
            sessionStorage.clear();
        </script>
    </head>
    <body>
        <!-- HTML -->
    </body>
</html>
Gerard Cuadras
  • 1,655
  • 1
  • 17
  • 23