How to Detect Browser Back Button event - Cross Browser

后端 未结 16 2778
鱼传尺愫
鱼传尺愫 2020-11-21 23:09

How do you definitively detect whether or not the user has pressed the back button in the browser?

How do you enforce the use of an in-page back button inside a sin

16条回答
  •  走了就别回头了
    2020-11-21 23:48

    I tried the above options but none of them is working for me. Here is the solution

    if(window.event)
       {
            if(window.event.clientX < 40 && window.event.clientY < 0)
            {
                alert("Browser back button is clicked...");
            }
            else
            {
                alert("Browser refresh button is clicked...");
            }
        }
    

    Refer this link http://www.codeproject.com/Articles/696526/Solution-to-Browser-Back-Button-Click-Event-Handli for more details

提交回复
热议问题