jQuery or JS handling browsers back button

后端 未结 2 1590
野性不改
野性不改 2021-01-14 17:31

Any ideas how to intercept the browser back button via jQuery, so I can run my event function? I don\'t need to use jQuery BBQ or jQuery Address, only prevent the default be

2条回答
  •  猫巷女王i
    2021-01-14 17:48

    In jQuery land:

    $(window).unload( function () { /*code here*/ });
    

    EDIT- There was a parentheses instead of a close bracket

    EDIT - Removed Extra Semicolin

提交回复
热议问题