Languages

Menu
Sites
Language
How can use confirm() function?
alert() is work but confirm is not.
 
( function () {
    window.addEventListener( 'tizenhwkey', function( ev ) {
        if( ev.keyName === "back" ) {
            var activePopup = document.querySelector( '.ui-popup-active' ),
                page = document.getElementsByClassName( 'ui-page-active' )[0],
                pageid = page ? page.id : "";
            screen.lockOrientation("portrait-primary");
            if( pageid === "one" && !activePopup ) { 
            alert('page one');           
var exit = confirm("exit");
if(exit){
tizen.application.getCurrentApplication().exit();
}
        /*try {
                tizen.application.getCurrentApplication().exit();
            } catch (ignore) {
            }*/
        
            } else {
                window.history.back();
            }
        }
    } );
} () );

Responses

1 Replies
André Reus

hi 명훈 심, did you try with a ui-popup ? 
With ui-popup you may show a popup with message 'are you sure to exit?' and with yes/no button. 
If user clicks on yes simply exit the app... 

Here is the code and structure for popup

<div class="ui-page">
    <div class="ui-header">

    </div>
    <div class="ui-content">

    </div>
    <div class="ui-footer">

    </div>
    <div class="ui-popup">
        
    </div>
</div>