cordova-plugin-inappbrowser icon indicating copy to clipboard operation
cordova-plugin-inappbrowser copied to clipboard

inappbrowser app://close is not working on iOS

Open kotran88 opened this issue 3 years ago • 4 comments

I had publish app to appstore. and it works very well. but I'm now did some change on code and found out that on IOS13 inappbrowser is not open properly( it close web right after open animation). I saw inappbrowser change log and upgrade to 4.1.0 open very well! but the problem is that on web view, I close web by clicking web button which is defined as window.open(app://close) but it's not working anymore

web html 's script

function popClose(){
   window.open('app://close');
}

on web browser, I clicked button and it goes to popClose. but it's not closed on iOS... it even don't come to call back of browser.on('loadstars').subscribe() when trigger popClose function

Ionic code is as below.


  const browser = this.iab.create(url, '_blank', { location : 'no', toolbar : 'yes', zoom : 'yes' });
    browser.on('loadstart').subscribe(
      (event) => {
        console.log('###### browser start ###### ');
        console.log(event);
        if(event.url.indexOf("tel")>-1){
            console.log("gfogo")
            console.log(event.url.split("tel:")[1]);
            this.callNumber(event.url.split("tel:")[1]);
        }

        if(event.url == 'http://app://close' || event.url == 'app://close' || event.url == 'close') {
          browser.close();
        }
        console.log('###### browser end ###### ');
        
      }
    );

kotran88 avatar Jan 25 '21 06:01 kotran88

can you provide a sample app?

jcesarmobile avatar Feb 10 '21 17:02 jcesarmobile

the issue is related to:

https://github.com/apache/cordova-plugin-inappbrowser/issues/290 https://github.com/apache/cordova-plugin-inappbrowser/issues/649 https://github.com/apache/cordova-plugin-inappbrowser/issues/423

apparently if the browser window isn't visible you can't close it. I think the way the page is opened it's the issue.

I'm in a situation where i need to close the window when the app goes in background and i can't unless i first show it and then close it and this doesn't make any sense.

Beside, it's different issue, on ios, the page doesn't go fullscreen but where there is the notch i can see some space in the top.

Please provide assistance.

Thank you and regards

marshall86 avatar Apr 08 '21 13:04 marshall86

Use const browser = this.iab.create('https://ionicframework.com/','_system','hidden=no'); and try!

techrationaldev avatar Aug 21 '21 07:08 techrationaldev

IONIC CORDOVA

For some reason iOS does not close the instance of InAppBrowser when the instance is hide(), so the alternatives are to initialize it as hidden or show it with show() before closing the instance.

Example: const iab: InAppBrowser; const browser = this.iab.create('https://ionicframework.com/', 'blank', {hidden: 'false'}); browser.close();

Or you initialize hidden const browser = this.iab.create('https://ionicframework.com/', 'blank', {hidden: 'true'}); browser.show(); browser.close();

isaacsuazo7 avatar Aug 10 '22 22:08 isaacsuazo7