Hello,
I got a service with my inappbrowser module :
// WEB VIEW -------------------------
@Component({})
export class OpenWebview {
constructor(private platform: Platform) {
}
public open(url, locationBar) {
this.platform.ready().then(() => {
if(this.platform.is('ios')) {
cordova.InAppBrowser.open(url, "_blank", "location="+locationBar + ",enableViewportScale=yes,disallowoverscroll=yes,presentationstyle=pagesheet");
} else {
cordova.InAppBrowser.open(url, "_blank", "location="+locationBar);
}
});
}
}
And in my page index.ts I create a loop to search all links and inject a webview if cordova is use
import {Component} from '@angular/core';
import {NavController, NavParams, Platform} from 'ionic-angular';
import {ClientService, OpenWebview} from '../services/services';
@Component({
templateUrl: 'build/pages/elua/elua.html',
providers: [ClientService, OpenWebview]
})
export class EluaPage {
private menuState:any;
private clientInfos:any;
private eula:any;
constructor(private nav: NavController, navParams: NavParams, private openwebview: OpenWebview, private platform: Platform) {
var self = this;
platform.ready().then(() => {
this.openView();
});
this.menuState = navParams.get('menuState') || 'disabled';
this.clientInfos = navParams.get('clientInfos');
this.eula = this.clientInfos.eula;
}
openView() {
var self = this;
var links = document.getElementsByTagName('a');
for (var i:number = 0; i < links.length; i++) {
function whatClicked(evt) {
evt.preventDefault();
var url = evt.target.href;
if (!self.platform.is('cordova')) {
window.location.href = url;
} else {
self.openwebview.open(url, 'yes');
}
}
links[i].addEventListener("click", whatClicked, false);
}
}
}
In browser it’s working perfectly but when I try to emulate on my Iphone (ionic view or build) or on ios-sim
I got a white screen.
Somebody can help me please ?