Is there a way to detect the refresh button click (F5) in a specific scenario? I have a task that involves clearing my localStorage whenever the refresh button is clicked, but also ensuring that if the URL changes or the page is closed, the localStorage retains its data. I've come across various topics related to this issue, with the main suggestion being to use window.onbeforeunload. However, this event seems to trigger at any change, not just when the page is refreshed (e.g., changing the URL, pressing ctrl + shift + R, F5, or ctrl + R). Is it possible to specifically identify and handle only the refresh event? For instance, by comparing the current URL with the one the user intends to open and refreshing only if they are the same?