Load Dynamic CDN's or script file's inside reactive web app
881
Views
8
Comments
Out of scope
Frontend (App Interfaces)

Hello,

Sometimes we have to add dynamic CDNs or script files to our applications 

like:- 

<script src="https://maps.googleapis.com/maps/api/js?key="api_key"&callback=initMap&v=weekly" defer></script > 

The major reason behind this because some script and CDN files are updating regularly (like maps.googleapis.com ) so to make sure that our code is always up to date there is a way to add URLs of that particular code


What is the idea? You can already do this right?

Hello @Daniel Kuhlmann ,

The idea is that OutSystems should have the ability to add a CDN URL to the page itself

Thanks,

Regards Gourav Shrivastava

But you can that is my point, you can add scripts dynamically already.

Hello  @Daniel Kuhlmann 

Thanks for reply 

Can you please suggest how we can add a dynamic script with a URL I have checked everywhere and have not been able to find the best solution for that Some solutions are there like adding a head tag in HTML on-screen oninitialize action but it cannot load full script 

Thanks,

Regards Gourav Shrivastava

Hi Gourav,

See this old discussion:
https://www.outsystems.com/forums/discussion/55258/load-external-js-in-outsystems-reactive-web-app/

You can add into the OnInitialize event of your screen this javascript below 

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,

Daniel

Hello  @Daniel Kuhlmann 

Thanks for reply 

I already tried this but it cannot able to load the full script . It works only when the file or script contains a low amount of code. 

working with the big script it cannot load the full script

Thanks,

Regards Gourav Shrivastava

You should share that issue on the forum and ask for help. It should work.

I mark this idea as out-of-scope.

Changed the status to
Out of scope

Can already be done with some lines of Javascript