How to close InAppBrowser itself in Phonegap Application?

Posted by Shashi on Stack Overflow See other posts from Stack Overflow or by Shashi
Published on 2014-01-13T06:21:00Z Indexed on 2014/06/07 9:25 UTC
Read the original article Hit count: 204

Filed under:
|
|

I am developing Phonegap application and currently i am using InAppBrowser to display external pages. On some of the external pages I place a close button and i want to close the InAppBrowser itself. because InAppBrowser displays these pages that is why the reference of it is not accessed on itself to close it and Please do not suggest me to use ChildBrowser Plugin.

window.close(); //Not Worked for me
or  
iabRef.close();  //Also not Worked for me because iabRef is not accessible on InAppBrowser. It is created on Parent Window

Some of the Android device and iOS device display a Done Button to close it. As well as the iPad also display the Done button. but in Case of Android tablet there is not any kind of button to close it.

UPDATE :-

Here is my full code :-

var iabRef = null; 
function iabLoadStart(event) {
}
function iabLoadStop(event) {
}
function iabClose(event) { 
    iabRef.removeEventListener('loadstart', iabLoadStart);      
    iabRef.removeEventListener('loadstop', iabLoadStop); 
    iabRef.removeEventListener('exit', iabClose); 
}
function startInAppB() {
    var myURL=encodeURI('http://www.domain.com/some_path/mypage.html');
    iabRef = window.open(myURL,'_blank', 'location=yes');    
    iabRef.addEventListener('loadstart', iabLoadStart);
    iabRef.addEventListener('loadstop', iabLoadStop);
    iabRef.addEventListener('exit', iabClose);
}

© Stack Overflow or respective owner

Related posts about JavaScript

Related posts about cordova