I installed the inAppBrowser plugin for Ionic Cordova (at least I think I installed it correctly. I followed the directions here: https://cordova.apache.org/docs/en/latest/reference/cordova-plugin-inappbrowser/#installation).
I imported inAppBrowser into my app.module.ts file and added it to the list of providers:
import { InAppBrowser } from '@ionic-native/in-app-browser';
and
providers: [
StatusBar,
SplashScreen,
InAppBrowser,
{provide: ErrorHandler, useClass: IonicErrorHandler}
]
I also injected it into the relevant pages like this:
export class AboutPage {
options : InAppBrowserOptions = {
location : 'yes',
hidden : 'no',
clearcache : 'yes',
clearsessioncache : 'yes',
zoom : 'yes',//Android only
hardwareback : 'yes',
mediaPlaybackRequiresUserAction : 'no',
shouldPauseOnSuspend : 'no', //Android only
closebuttoncaption : 'Close', //iOS only
disallowoverscroll : 'no', //iOS only
toolbar : 'yes', //iOS only
enableViewportScale : 'no', //iOS only
allowInlineMediaPlayback : 'no',//iOS only
presentationstyle : 'pagesheet',//iOS only
fullscreen : 'yes',//Windows only
};
constructor(public navCtrl: NavController, public navParams: NavParams, private theInAppBrowser: InAppBrowser) {
}
public openWithSystemBrowser(url : string){
let target = "_system";
this.theInAppBrowser.create(url,target,this.options);
}
public openWithInAppBrowser(url : string){
let target = "_blank";
this.theInAppBrowser.create(url,target,this.options);
}
public openWithCordovaBrowser(url : string){
let target = "_self";
this.theInAppBrowser.create(url,target,this.options);
}
ionViewDidLoad() {
console.log('ionViewDidLoad AboutPage');
}
}
Then I added a button into the html page using:
<button ion-button (click)="openWithSystemBrowser('https://www.preachingfriars.org')">Visit our site</button>
It seems to work great in Android, but no luck in iOS. When I click the button nothing at all happens. I have been scouring the forums for days and still can't manage to make it work. I'd appreciate any help you could provide!
Thanks! Brent