Is there a way to detect if the user has pressed the refresh button using jquery or javascript?

前端 未结 5 2033
[愿得一人]
[愿得一人] 2021-01-22 12:48

I want to know if jquery or javascript can detect if the user has pressed the refresh button of their browser? If so can I see an example?

5条回答
  •  一生所求
    2021-01-22 12:59

    there is 1 way to detect it.

    check to see if F5 was pressed. as to detect if the actual refresh was clicked, that i'm not sure if its possible, but you can check against the key code

    JS Code .keypress()

提交回复
热议问题