Search code examples
jqueryjquery-mobileback

Is there an event that occurs after data-rel='back'?


I'm trying to compare the window.location.hash after a user has gone back a page using a button with data-rel='back'.

Is there an event which occurs at this point?


Solution

  • I found the answer here: http://view.jquerymobile.com/master/demos/navigation/

    // Respond to back/forward navigation
    $(window).on("navigate", function(event, data) {
        if (data.state.direction == "back") {
            alert("User navigated back.");
        }
    });