8
Views
3
Comments
Solved
Unable to load external javascript in native mobile application
Application Type
Mobile
Platform Version
11.10.1 (Build 23852)

Hi,

I wanted to load some external javascript for Stripe. 

URL: https://checkout.stripe.com/checkout.js

I am using RequireScript action on screen initialize to load js via URL but getting an error "Error adding script 'https://checkout.stripe.com/checkout.js' to document 'https://ishan-wasnik.outsystemscloud.com/StripeIntegration/Home?_ts=637455577833251502' .

Is there a different way to do this so that script would be loaded successfully. Due to frequent updations to the script, I need to fetch this from external URL and cannot store it on my application. 

Thanks,

Ishan

Rank: #2754
Solution

Hi,

Thanks for your reply :).

The issue was due to content security policy settings for my environment as it was not allowing external JS due to security constraints.  Javascript was able to load successfully after I disabled the CSP on my environment via LifeTime. 

Regards,

ishan

mvp_badge
MVP
Rank: #76

Hi Ishan,

I have tried to access the same JS library using the shared URL in a sample mobile application and it's working fine for me.

see this Sample App - JSLibrary

Browser Inspect Element section view

What I did?

  • Defined an OnReady Event Handler action flow for the respective screen
  • Introduced an RequireScript client action node, referring the same JS library URL, within the OnReady action flow 

And also I have tried to access the mobile application screen of which you have shared the url but it is not accessible because of the screen Anonymous Role uncheck.

Hope this helps you!


Kind regards,

Benjith Sam

Rank: #2754
Solution

Hi,

Thanks for your reply :).

The issue was due to content security policy settings for my environment as it was not allowing external JS due to security constraints.  Javascript was able to load successfully after I disabled the CSP on my environment via LifeTime. 

Regards,

ishan

mvp_badge
MVP
Rank: #76

You're welcome, Ishan.

Glad that you got it solved, and thank you for sharing the learnings with the community :) 


Best regards,

Benjith Sam