Worklight client-side API to overrideBackButton doesn't work

Posted by user2503429 on Stack Overflow See other posts from Stack Overflow or by user2503429
Published on 2013-06-26T15:51:00Z Indexed on 2013/06/26 16:21 UTC
Read the original article Hit count: 362

Filed under:

I want to make something happen when back button is pressed so I put this code in Myhtml.js file :

function wlCommonInit(){

    /*
     * Application is started in offline mode as defined by a connectOnStartup property in initOptions.js file.
     * In order to begin communicating with Worklight Server you need to either:
     * 
     * 1. Change connectOnStartup property in initOptions.js to true. 
     *    This will make Worklight framework automatically attempt to connect to Worklight Server as a part of application start-up.
     *    Keep in mind - this may increase application start-up time.
     *    
     * 2. Use WL.Client.connect() API once connectivity to a Worklight Server is required. 
     *    This API needs to be called only once, before any other WL.Client methods that communicate with the Worklight Server.
     *    Don't forget to specify and implement onSuccess and onFailure callback functions for WL.Client.connect(), e.g:
     *    
     *    WL.Client.connect({
     *          onSuccess: onConnectSuccess,
     *          onFailure: onConnectFailure
     *    });
     *     
     */

    // Common initialization code goes here

}

WL.App.overrideBackButton(backFunc);
function backFunc(){
alert('You will back to previous page');
}

but after build and deploy the app and I running it, nothing happened after I pressed back button, anybody have the solution ?

© Stack Overflow or respective owner

Related posts about worklight