vimmi26
1
home.ts code
import { Component } from '@angular/core';
import { InAppBrowser , InAppBrowserOptions } from '@ionic-native/in-app-browser';
@Component({
selector: 'page-home',
templateUrl: 'home.html'
})
export class HomePage {
options : InAppBrowserOptions = {
location : 'yes',//Or 'no'
hidden : 'no', //Or 'yes'
clearcache : 'yes',
clearsessioncache : 'yes',
hideurlbar : 'yes',
hidenavigationbuttons : 'yes',
//zoom : 'yes',//Android only ,shows browser zoom controls
hardwareback : 'yes',
mediaPlaybackRequiresUserAction : 'no',
shouldPauseOnSuspend : 'no', //Android only
};
constructor(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);
}
}
//home.html code
<ion-header>
<ion-navbar>
<ion-title>
EAZY SCHOOLS
</ion-title>
</ion-navbar>
</ion-header>
<ion-content padding>
<button ion-button (click)="openWithCordovaBrowser('https://www.google.com')">Open with System browser</button>
<button ion-button (click)="openWithCordovaBrowser('https://www.youtube.com')">Open with In App browser</button>
<button ion-button (click)="openWithCordovaBrowser('https://www.facebook.com')">Open with Cordova browser</button>
</ion-content>