120
Views
5
Comments
Setting "asynch" property for javascript
Question

I need to call below script in header of pages.

I know the approach to call normal javascripts.

But the problem is with property “asynch”.

This is mandatory and should be “asynch” only. If we do not set this property the script will fail. Script should be added in Header section of HTML and should be aynch otherwise it will fail.

Could you please suggest as how can we do this specifically.


<script src=https://XXXXX.com/somejavascript-development.min.js async></script>


2020-11-13 07-48-15
Khuong Truong
2019-08-13 08-29-00
Antu Singh

Hi Khuong 

Thanks for the information provided by you.

However I am looking for the option to add property "asynch" in javascript.

2021-03-18 21-03-15
Benjith Sam
 
MVP

Hi Antu,

In addition to the previous solution, You can also try the below mentioned JS approach..

- Using a JS node (for reactive) in the OnInitialize handler execute the below script

JavaScript Snippet:

(function() {
    var scriptEle = document.createElement('script'); 
    scriptEle.type = 'text/javascript'; 
    scriptEle.async = true;
    scriptEle.src = '<src>';
    
    var s = document.getElementsByTagName('script')[0]; 
    s.parentNode.insertBefore(scriptEle, s);
    
  })();

I hope this helps you!


Kind regards,

Benjith Sam

2025-01-15 08-35-04
Vignesh Sekar

Hi @Antu Singh 

approach 1 : Interface -> Scripts ->Create Script -----------just copy and paste the whole content of that min.js , if that throws error

approach 2 :use  requirescript

oninitialize just use that  require script and pass https://XXXXX.com/somejavascript-development.min.js  in URL

Hope it will work

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