I do not think there are events called onrefresh or onreload. You can know when the page is being loaded, but knowing why (that is, where the user goes next) is outside the JavaScript security sandbox. The only way to find out if the page was reloaded is to know where the user was in the last page request, which also goes beyond JavaScript. Sometimes you can get this through document.referrer, but it uses browser security settings to allow access to this information.
Rex m source
share