i tried to open external url using InAppBrowser from "ionic-native/in-app-browser". It's working fine while debugging in browser but error in debug with real device. error given bellow
ERROR Error: Uncaught (in promise): Error: Java exception was raised during method invocation Error: Java exception was raised during method invocation at androidExec (cordova.js:960) at module.exports (inappbrowser.js:113) at new InAppBrowserObject (vendor.js:84078) at InAppBrowser.push../node_modules/@ionic-native/in-app-browser/ngx/index.js.InAppBrowser.create (vendor.js:84119) at PaymentComponent. (default~order-order-module~products-order-order-info-order-info-module~products-order-takeaway-page-~77b4b037.js:408) at step (vendor.js:161589) at Object.next (vendor.js:161570) at fulfilled (vendor.js:161560) at ZoneDelegate.push../node_modules/zone.js/dist/zone.js.ZoneDelegate.invoke (polyfills.js:3239) at Object.onInvoke (vendor.js:59091) at resolvePromise (polyfills.js:3700) at polyfills.js:3610 at rejected (vendor.js:161561) at ZoneDelegate.push../node_modules/zone.js/dist/zone.js.ZoneDelegate.invoke (polyfills.js:3239) at Object.onInvoke (vendor.js:59091) at ZoneDelegate.push../node_modules/zone.js/dist/zone.js.ZoneDelegate.invoke (polyfills.js:3238) at Zone.push../node_modules/zone.js/dist/zone.js.Zone.run (polyfills.js:2998) at polyfills.js:3758 at ZoneDelegate.push../node_modules/zone.js/dist/zone.js.ZoneDelegate.invokeTask (polyfills.js:3271) at Object.onInvokeTask (vendor.js:59082)
import { InAppBrowser } from '@ionic-native/in-app-browser/ngx';
constructor(
private iab: InAppBrowser
) {
const browser = this.iab.create('https://ionicframework.com/');
browser.close()
//or
const browser1 = this.iab.create(https://ionicframework.com/);
browser1.show();
}
In my app there is no need to show the browser, and especially not to close it right after creation..
Can you try the '_system' argument to open a browser with the system default? That might explain the error on a real device
const browser = this.iab.create('https://ionicframework.com/', '_system');
The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.