Ionic 4 - InAppBrowser

This forum contains topics that were moved from Get Satisfaction
Dupdroid
Posts: 0
Joined: Sat Mar 30, 2013 9:07 pm

Ionic 4 - InAppBrowser

Post by Dupdroid »

I followed the instructions below in my Ionic 4 app and I get the following error:

ERROR in src/app/Screen1/Screen1.ts:31:28 - error TS2339: Property 'InAppBrowser' does not exist on type 'Cordova'.

https://docs.appery.io/docs/cordova-i...

Code as per Appery tutorial:

codeif (window.cordova) {
cordova.InAppBrowser.open('https://www.google.com', '_self', 'location=yes');
} else {
console.log('no cordova');
}/code

I have also tried:

codeif (window.cordova) {
window.cordova.InAppBrowser.open('https://www.google.com', '_self', 'location=yes');
} else {
console.log('no cordova');
}/code

Serhii Kulibaba
Posts: 147
Joined: Tue Aug 27, 2013 1:47 pm

Ionic 4 - InAppBrowser

Post by Serhii Kulibaba »

Hello,

This example works for JQM apps, but not for Ionic 4.

Please use the following code for Ionic 4 applications: pre(window).cordova.InAppBrowser.open("https://google.com") - так /pre

Dupdroid
Posts: 0
Joined: Sat Mar 30, 2013 9:07 pm

Ionic 4 - InAppBrowser

Post by Dupdroid »

Still getting the same error:

codeERROR in src/app/Screen1/Screen1.ts:36:30 - error TS2339: Property 'InAppBrowser' does not exist on type 'Cordova'. 36 (window).cordova.InAppBrowser.open('https://www,google.com');/code

Dupdroid
Posts: 0
Joined: Sat Mar 30, 2013 9:07 pm

Ionic 4 - InAppBrowser

Post by Dupdroid »

Hi Serhii, can you please get back to me on this issue? The code you provided does not work.

Serhii Kulibaba
Posts: 147
Joined: Tue Aug 27, 2013 1:47 pm

Ionic 4 - InAppBrowser

Post by Serhii Kulibaba »

Sorry, getsatisfaction changed the code... the correct is:

pre(<any>window)&#46;cordova&#46;InAppBrowser&#46;open("https:&#47;&#47;google&#46;com");/pre

Dupdroid
Posts: 0
Joined: Sat Mar 30, 2013 9:07 pm

Ionic 4 - InAppBrowser

Post by Dupdroid »

Still no luck...

core.js:9110 ERROR Error: Uncaught (in promise): TypeError: Cannot read property 'InAppBrowser' of undefined

Serhii Kulibaba
Posts: 147
Joined: Tue Aug 27, 2013 1:47 pm

Ionic 4 - InAppBrowser

Post by Serhii Kulibaba »

Have you enabled the inAppBrowser plugin?

Do you run the application on the real device, not in the browser? (inAppBrowser doesn't work in a simple browser, please use window.open there)

Dupdroid
Posts: 0
Joined: Sat Mar 30, 2013 9:07 pm

Ionic 4 - InAppBrowser

Post by Dupdroid »

Yes, I am testing on a real iPhone.

This my code:

codetry {
if (( < any > window)&#46;cordova) {
alert('cordova found');
( < any > window)&#46;cordova&#46;InAppBrowser&#46;open('https:&#47;&#47;www&#46;google&#46;com');
} else {
alert('cordova not found');
( < any > window)&#46;open('https:&#47;&#47;www&#46;google&#46;com', '_self');
}
} catch (err) {
alert(err&#46;message);
}/code

See screenshot.

Image

This is really frustrating. Can you please assist?

Dupdroid
Posts: 0
Joined: Sat Mar 30, 2013 9:07 pm

Ionic 4 - InAppBrowser

Post by Dupdroid »

Also, if I activate Auto Updates by checking the checkbox on the IOS binary tab and checking the "Hot Code Push Plugin" then the App simple crashes on the iPhone.

Serhii Kulibaba
Posts: 147
Joined: Tue Aug 27, 2013 1:47 pm

Ionic 4 - InAppBrowser

Post by Serhii Kulibaba »

Please share (https://docs.appery.io/docs/teams-sha...) your app with a href="mailto:support@appery.io" rel="nofollow"support@appery.io/a and provide us with the app name. It seems you didn't include the inAppBrowser plugin or something else. We will check it

Post Reply