Unable to call external javascript in native mobile application outsystems
Question
Application Type
Mobile

Unable to call external javascript in native mobile application OutSystems.


I have used below code to load the external JS on the mobile screen onReday event.

var head1 = document.getElementsByTagName('head')[0];
var script_src1= "your_js_url_with_parameters";
var new_script1 = document.createElement('script');
new_script1.type = 'text/javascript';
new_script1.src= script_src1;
head1.appendChild(new_script1);


Regards,

Ravindra

Solution

Hello @Ravindra Singh Kushwah

That's an interesting approach for sure. The only way I am aware of using javascript code from an external library is as explained in the article below. Hope it works for your use case.

https://success.outsystems.com/Documentation/11/Extensibility_and_Integration/JavaScript/Extend_Your_Mobile_and_Reactive_Apps_Using_JavaScript/Use_JavaScript_Code_from_an_External_Library

Regards,

AJ

mvp_badge
MVP

I marked AJ's reply as solution, as this is the preferred way of using external JS libraries in OutSystems.

Champion

Hi,

  • In case you need to call the JS; it should be a JS function declared somewhere.
  • If needs to apply directly then you can use it on onLoad or onDOMReady
  • If needs to use with a specific element then there's the option of using it via extended property

- Assif

Community GuidelinesBe kind and respectful, give credit to the original source of content, and search for duplicates before posting.