Load external JS in Cordova + Windows 8.1 app

Asked

Viewed 227 times

0

Currently I have developed an html app with Angular where I need to make a transparent checkout in Pagseguro. To this end they ask for the inclusion of an external JS:

<script type="text/javascript" src="https://stc.pagseguro.uol.com.br/pagseguro/api/v2/checkout/pagseguro.directpayment.js"></script>

In the Web application, Cordova + Android and Cordova + Windows 10 had no problems (changing the security meta tag, of course). But in the app Cordova + Windows 8.1 this script does not load! Reading on the subject I found that this is nothing new because Windows 8 has a restricted access policy of HTML apps to external content such as CSS, Images and JS for security reasons.

I tried to download this JS from Pagseguro and insert it manually into the project, however several JS errors occur due to other requests that this file does.

The question then is: how to get around this? How could I get this JS without all this headache?

1 answer

0

Yes, there is a way yes! Well as they made a "gambiarra" to put maps Google Maps, can use the same technique. Just insert an iframe:

<iframe src="ms-appx-web:///pagseguro.html"></iframe>

This "pagseguro.html" page is a local file in the WWW folder of Cordova and should contain the link to the script:

<script type="text/javascript" src="https://stc.pagseguro.uol.com.br/pagseguro/api/v2/checkout/pagseguro.directpayment.js"></script>

Browser other questions tagged

You are not signed in. Login or sign up in order to post.