Tuesday, 7 May 2019

JQueryMobile - pagecontainerbeforeshow: remove previous page from history

Using jquery and the callback pagecontainerbeforeshow I want to remove the previous page from the navigationhistory - that is if the user navigates from page1 to page2, and the user clicks on the backbutton I want to exit the "app".

I found the same question here but I dont know how to implement the answer in pagecontainerbeforeshow?

Jquery mobile, remove previous page

 bindEvents: function() {

    $(document).on("pagecontainerbeforeshow", function(event,ui){

        var destinationPage = ui.toPage.prop("id");
        var sourcePage = ui.prevPage.prop("id");

        d.lg("destionationPage: " + destinationPage);
        d.lg("sourcePage: " + sourcePage);
        console.log("page to be shown =" + destinationPage);
        switch(destinationPage) {
            case 'restaurants':
                d.lg('redirected to list');

            break;
            case 'offers':

                d.lg('redirected to offers');

            break;

            }
        }); 
}



from JQueryMobile - pagecontainerbeforeshow: remove previous page from history

No comments:

Post a Comment