Thế Hải Nguyễn Thế Hải Nguyễn - 3 years ago 93
Javascript Question

How to know user reload page by javascript

I stored a variable in sessionStorage. When I reload the webpage, sessionStorage don't set this variable to null. I must close the window and open a new one to do this. So, How can I know user reload page by javascript, I need sessionStorage set to null when I reload page

Answer Source

As suggested by @sideroxylon


This will fire whether the user reloads the page or navigates away.

Recommended from our users: Dynamic Network Monitoring from WhatsUp Gold from IPSwitch. Free Download