Quantcast
Channel: Ionic Forum - Latest topics
Viewing all articles
Browse latest Browse all 70904

External JS library resolves in browser but not on android device

$
0
0

I’m dependent on an external JS library for my project (BrowserPrint)
I tried importing the minified javascript files trough angular.json

"scripts": [
    "./node_modules/zebra/BrowserPrint-3.0.216.min.js",
    "./node_modules/zebra/BrowserPrint-Zebra-1.0.216.min.js",
    "./node_modules/zebra/external.js"
 ],

As you can see i added a simple external.js file myself to make sure that the files are picked up correctly.
To be more precise, the code contained by the external.js file contains the following code:

function ExternalJsFunction() {
    alert('hi');
}

when I import both libraries in my component as follows (BrowserPrint is a declared variable in the minified browserprint javascript file):

declare var BrowserPrint;
declare var ExternalJsFunction;

I am able to use the ExternalJSFunction in both the webapp (Ionic serve) and the (emulated) Android app (ionic cordova emulate android)
The problem is that the BrowserPrint variable is recognised in the webapp (Ionic serve) but NOT in the (emulated) Android app (ionic cordova emulate endroid).

Console logged as (emulated Android):

console.log('i am browserprint', BrowserPrint);

Results in:

[console.log]: "i am browserprint" {}

In the webapp (ionic serve) this works just fine.
Is there any reason why this particular JS library would load correctly in the webapp but not on Android?

Any help is much appreciated!

2 posts - 2 participants

Read full topic


Viewing all articles
Browse latest Browse all 70904

Trending Articles



<script src="https://jsc.adskeeper.com/r/s/rssing.com.1596347.js" async> </script>