0

I have a problem with the back button of the Smartphones. My app connects to a server and u get a session ID where it needs to work. So when i log out from the server the session will be deleted and everthing its okay. Session ID saved local on the smartphone and on logout it will be delete.

Scenario: Loginpage ---(Log in)---> Mainpage ---(Log out)---> Loginpage

But when i log out and touch the back button of a smartphone it goes back to the Mainpage. And that shouldnt work.

The solution looks like: Loginpage ---(Log in)---> Mainpage ---(Log out)---> Loginpage ---(Press back button)--->App exit

So how can i solve this problem ? Hope u understand me :))

4

1 回答 1

1

该解决方案对我来说很好。

document.addEventListener("deviceready", onDeviceReady, false);

    function onDeviceReady() {
        document.addEventListener("backbutton", onBackKeyDown, false);
    }

    function onBackKeyDown() {
        navigator.app.exitApp();
    }

希望我也可以帮助某人解决这个问题。

于 2013-07-17T21:00:45.983 回答