开发者

Determine if page was refreshed

开发者 https://www.devze.com 2023-03-17 22:47 出处:网络
Would it be possible to determine if a webpage was accessed from the result of a refresh (pressing F5 or sim开发者_运维知识库ply clicking the refresh button) using JavaScript? I\'m also using jQuery.T

Would it be possible to determine if a webpage was accessed from the result of a refresh (pressing F5 or sim开发者_运维知识库ply clicking the refresh button) using JavaScript? I'm also using jQuery.


Try using the onbeforeunload() function or jQuery unload()


Not sure jQuery will help you here, but you could try

<html>
    <body onUnLoad='alert("Please do not leave!")'>
</html>

Should note that this will fire whenever the user tries to leave your page (Refresh or otherwise).

0

精彩评论

暂无评论...
验证码 换一张
取 消