問題:
I want to check when someone tries to refresh a page.我想檢查何時有人嘗試刷新頁面。
For example, when I open a page nothing happens but when I refresh the page it should display an alert.例如,當我打開一個頁面時什麼也沒有發生,但是當我刷新頁面時它應該顯示一個警報。
解決方案:
參考一: https://stackoom.com/question/L01S參考二: Check if page gets reloaded or refreshed in JavaScript