detecting browser back button in javascript/jquery without using any external plugins

前端 未结 2 1849
别那么骄傲
别那么骄傲 2021-01-03 01:08

I want to detect browser back button in java-script/jquery without using any external plugins.

I am going to support following browsers

IE8,IE9,FireF

2条回答
  •  刺人心
    刺人心 (楼主)
    2021-01-03 01:33

    That can be simply dropped into your web page, and when the user clicks back, it will call a function. The default function on this call is a javascript alert “Back Button Clicked”.

    To replace this functionality, you simply need to override the OnBack function. This can be done by using the code below.

    
    

    This will now replace the “Back Button Clicked” alert with a “You clicked it!’” alert.
    support following browsers IE8,IE9,FireFox,Chrome
    Browser Back Button Detection
    Or using jquery
    Catching browser back
    Using standard javascript
    Mastering The Back Button With Javascript

提交回复
热议问题