AddEventListener ('exit') for inappbrowser in PhoneGap

I try to exit the application when inappbrowser closes. I am trying to do this by adding eventlister to the browser and then from there .. maybe like exit (0) or something else. But it does not work, a warning is never reached.

Does anyone know why? Also, if you have a better idea on how to exit the application when inappbrowser closes, share it.

I use a handset.

var ref = null;

ref = window.open('http://google.com', '_self', 'location=no');
ref.addEventListener('exit', function(event) { alert("hello");});
+4
source share
2 answers

"_ blank" "_ self" . 'exit' , .

,

navigator.app.exitApp();

:

 var ref = window.open('http://google.com', '_blank', 'location=no');

     ref.addEventListener('exit', function(event){  Exit(); });

 function Exit(){
              navigator.notification.confirm(
                'Do you want to exit app?',  
                function(i){
                    if(i==2)
                     {
                       navigator.app.exitApp(); //This will Close the App
                     }
                },              
                'App Name',            
                'Cancel,Exit'          
              );
 }

, .

+6

, loadstop inappbrowser inappbrowser.

0

Source: https://habr.com/ru/post/1539206/


All Articles