Software Archive
Read-only legacy content
17060 Discussions

Strategy for loading Internet-based JavaScript libraries from XDK app?

Jeff_B_
Beginner
956 Views

We have a library that that we have used for our web-based applications. Generally, we simply load the library using a script tag:

script type="text/javascript" src="http://somesite.com/widget.js"

It appears the library also pulls in other resources/scripts from the Internet from their own site.

I just can't seem to make this work in an XDK app. Is there a permissions issue or some other strategy that might allow this to work? All my other libraries I can copy and use locally, but this library has never worked when we tried to use a local copy. It only works when we reference the library at the vendor's website, but it has always worked well when we do that.

Any ideas on what I might be doing wrong or is this somehow not allowed?

FWIW, I have another Internet-based library that we wrote ourselves which I am referencing from the XDK app, pointing to our own server. So, it is definitely possible to load Internet-based scripts. I load the script via jQuery's "getScript()" method, but that strategy did not work with this other library. Our library does not have any other Internet resources/scripts, so it is obviously simpler than this vendor's library.

Thanks for any advice.

0 Kudos
2 Replies
Barry_Johnson
New Contributor I
956 Views

The "recommended" strategy is to not do it. For the best user experience and reliability any dependencies should be on the device. However, I understand this likely isn't an option for you. I would contact the library vendor to see what they recommend for mobile hybrid apps. My guess is the issue in how they are loading up their extra dependencies. Are you seeing any errors in the console or network tabs when you on-device debugging?

0 Kudos
Elroy_A_Intel
Employee
956 Views

You can perform on-Device debugging wirelessly under the Test tab which enables you view the console output, Network resources and Timeline and other features after running your application via the Intel App Preview.

Note: You will be required to Sync your project with our testing servers first.

You can also Debug your application via USB under the Debug Tab.

0 Kudos
Reply