diyDevApp icon indicating copy to clipboard operation
diyDevApp copied to clipboard

Cordova Plugin Inappbrowser Giving Errors on run

Open thesourav123 opened this issue 6 years ago • 8 comments

App is built , cordova plugin has been added. But, when the inappbrowser is called, it is giving the following error ReferenceError: cordova is not defined at openBrowser (http://10.90.84.82:8100/js/services.js:101:7) at http://10.90.84.82:8100/js/services.js:322:22 at http://10.90.84.82:8100/lib/ionic/js/ionic.bundle.min.js:162:305 at m.$eval (http://10.90.84.82:8100/lib/ionic/js/ionic.bundle.min.js:176:467) at m.$digest (http://10.90.84.82:8100/lib/ionic/js/ionic.bundle.min.js:174:47) at b.$apply (http://10.90.84.82:8100/lib/ionic/js/ionic.bundle.min.js:177:249) at HTMLButtonElement. (http://10.90.84.82:8100/lib/ionic/js/ionic.bundle.min.js:472:11589) at HTMLButtonElement.dispatch (https://code.jquery.com/jquery-3.1.1.min.js:3:10315) at HTMLButtonElement.q.handle (https://code.jquery.com/jquery-3.1.1.min.js:3:8342) at n (http://10.90.84.82:8100/lib/ionic/js/ionic.bundle.min.js:22:384)

thesourav123 avatar Apr 24 '18 15:04 thesourav123

Good one!

I think the injection plugin does inject cordova.js in the new window

I can look at it next week probably but likely needs some investigation with the plugin itself

Tommertom avatar Apr 24 '18 15:04 Tommertom

kool thanks..kindly keep me posted. Great Work by the way, Its way more flexible and easy to work with

thesourav123 avatar Apr 24 '18 15:04 thesourav123

i think the issue is with deviceready not being fired before the browser is called.

thesourav123 avatar Apr 24 '18 17:04 thesourav123

Ok. So consider closed? Otherwise plse post the code u use

Tommertom avatar Apr 26 '18 05:04 Tommertom

No, please dont close it. I don't have the solution, i just found a probable cause. In my current app, the inappbrowser is called for oAuth authorization in the start, which might not be working for DevApp context. So now i will try to create another client app where i call inappbrowser inside a button or something and will see what happens.

Thanks

thesourav123 avatar Apr 26 '18 12:04 thesourav123

Nope, inappbrowser not opening at all. Although, deviceready is being fired due to which i am not getting Cordova Not Defined error.

Created a simple project with a button to open the browser https://github.com/thesourav123/devapp_testing .

thesourav123 avatar Apr 26 '18 13:04 thesourav123

ok. will test myself next week.

Tommertom avatar Apr 26 '18 18:04 Tommertom

Can't reproduce with your repo - the button click does not trigger event (even after fixing small syntax issue on line 31 of app.js). Iam not into angular v1 to check how to get event handling done.

Mine seems to work: https://github.com/Tommertom/inappbrowsertest

After adding inAppBrowser to diyDevApp: ionic cordova plugin add cordova-plugin-inappbrowser

Tommertom avatar Apr 28 '18 17:04 Tommertom