Cordoba avoids reloading the page in the browser back

I use Cordova 5.0.0 to download an external website, specifying this in the config.xml file:

<content src="http://www.example.com" />

on the website, I have links to other pages. When I click the links, it goes to a new page, but when I click the back button (for example, on Android), it reloads the last page (that is, performs a complete reboot from the server) instead of just continuing from the last place I was in without an update. Is there a solution for this?

+4
source share
1 answer

Try the following:

function onBackButtonTapped() {
    history.go(-1); // Back
    //document.location.reload(true); // Reload (if needed)
}
function onDeviceReady() {
    document.addEventListener("backbutton", onBackButtonTapped, false);
}
// Handle BackButton
document.addEventListener("deviceready", onDeviceReady, false);
+1
source

All Articles