0
votes

I have a PhoneGap/JQuery Mobile application which has a 'Settings' page with a 'Back' button in the header, used to go back to the previous page. I need the previous page to refresh when the back button is clicked.

I have managed to get this working on a Desktop browser by using document.referrer by doing $.mobile.changePage(referrer, {reloadPage:"true"}); but a referrer doesn't seem to exist on an Android PhoneGap application.

I have tried adding data-ajax="false" and data-rel="external" on the back button but this doesn't work and I have searched for answers all over and not found anything relevant.

Thanks.

3

3 Answers

0
votes

A temporary solution I have found is to send a code in the URL and then use a switch statement to get the full referrer url. I'm sure there are better ways to do this.

<a href="Settings.html?ref=in">Settings</a>

switch(getUrlParam('ref')) {
    case "in":
        page="index.html";
        break;
}

$.mobile.changePage(page, {pageReload:"true"});
0
votes

Delete the rel="back" in the back button and put a link to the page in the href="#" field.

In this way it will go back but it will be considered a link like any other and will refresh.

0
votes

At pageinit, markup all the back buttons to have data-ajax="false"

$(document).on('pageinit', function(event, data){
    $('a[data-rel=back]').attr('data-ajax', 'false');
});