Hello all!
I’m trying to get the browser to launch within my Ionic App. I’ve been following the directions on ‘https://ionicframework.com/docs/native/in-app-browser#usage’ which references the github docs: ‘https://github.com/apache/cordova-plugin-inappbrowser’.
This is my code:
import { InAppBrowser } from '@ionic-native/in-app-browser/ngx';
---
const browser = this.iab.create('https://google.com/', '_blank');
browser.on('loadstop').subscribe(event => {
console.log('Loaded!')
browser.close();
Now you’ll notice that I’m using ‘create’ instead of ‘open’ referenced on the github docs. When I hover over create, it gives me the same function description as does ‘open,’ specifically:
Opens a URL in a new InAppBrowser instance, the current browser instance, or the system browser.
@param
url
— The URL to load.@param
target
— The target in which to load the URL, an optional parameter that defaults to _self.
So if create works with the same functionality as open, referenced in the Github doc - why when I pass in ‘_blank’ it opens up a separate window to Google, instead of within the App? (Also that subscribe call fails as it doesn’t catch the ‘loadstop’ event.) If it helps, I’m running this ionic app in my Lab environment using ‘Ionic serve -l’.
Thanks for your help in advance!
1 post - 1 participant