@Robbannn wrote:
After implementing lazy loading in my application i experience weird behaviour when using InAppBrowser.
I get an error, 'Invalid event targets', when trying to subscribe to InAppBrowser events. Just like in this post.
When i exit the inAppBrowser the app restarts.
I run the application on my android device, where the following code has done the job for me before.
public viewPdf(path: string):Promise<any>{ return new Promise<any>((resolve, reject) => { if(this.platform.is('cordova')){ this.loaderService.showLoader("Loading document..."); } firebase.storage().ref().child(path).getDownloadURL().then(url => { let newURL = 'https://docs.google.com/viewer?&url=' + encodeURIComponent(url); this.browser = this.iab.create(newURL, '_blank', this.browserOptions); if(this.platform.is('cordova')){ this.handleBrowserSubscriptions(); } resolve(); }) .catch(err => { if(this.platform.is('cordova')){ this.loaderService.dismissLoader(); } reject(err); }); }) } private handleBrowserSubscriptions():void{ let stopSub = this.browser.on('loadstop').subscribe(event => { this.loaderService.dismissLoader(); stopSub.unsubscribe(); errorSub.unsubscribe(); }); let exitSub = this.browser.on('exit').subscribe(event => { this.loaderService.dismissLoader(); exitSub.unsubscribe(); this.browser.close(); }); let errorSub = this.browser.on('loaderror').subscribe(event => { this.loaderService.dismissLoader(); this.browser.close(); stopSub.unsubscribe(); errorSub.unsubscribe(); }); }Cordova CLI: 7.0.1
Ionic Framework Version: 3.2.0
Ionic CLI Version: 2.2.1
Ionic App Lib Version: 2.2.0
Ionic App Scripts Version: 1.3.7
ios-deploy version: Not installed
ios-sim version: Not installed
OS: Windows 10
Node Version: v6.9.4
Xcode version: Not installed@ionic-native/in-app-browser@3.12.1
cordova-plugin-inappbrowser@1.6.1After some hours googling this issue i have come up empty.
I would really appreciate if someone could help me out here.
Posts: 1
Participants: 1