Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

inappbrowser app://close is not working on iOS #844

Open
kotran88 opened this issue Jan 25, 2021 · 4 comments
Open

inappbrowser app://close is not working on iOS #844

kotran88 opened this issue Jan 25, 2021 · 4 comments

Comments

@kotran88
Copy link

kotran88 commented Jan 25, 2021

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 ###### ');
        
      }
    );
@jcesarmobile
Copy link
Member

can you provide a sample app?

@marshall86
Copy link

the issue is related to:

#290
#649
#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

@techrationaldev
Copy link

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

@isaacsuazo7
Copy link

isaacsuazo7 commented Aug 10, 2022

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();

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

5 participants