cancel
Showing results for 
Search instead for 
Did you mean: 

Load external js libraries

Former Member
0 Kudos

Hi,

I am trying to integrate external js libraries to build the AM Charts.

In the UI5.view.js file, am unable to load the js liraries with the following statement.

  jQuery.sap.require("js/amcharts.js");

Please help

Thanks

Mano.

Accepted Solutions (0)

Answers (3)

Answers (3)

Former Member
0 Kudos

You can add any external file as

jQuery.sap.registerModulePath("ModuleName","http://externalFileDomain.com");

jQuery.sap.require("ModuleName.jsFileName");

Former Member
0 Kudos

How do you get passed the Cross Original error?

No 'Access-Control-Allow-Origin' header is present on the requested resource.

0 Kudos

This message was moderated.

0 Kudos

This message was moderated.

surendra_pamidi
Contributor
0 Kudos

Hi Mano,

Use this in index.html not in view.js..

<script>

jQuery.sap.includeScript("somefile.js");

</script>

Regards,

Surendra.

Former Member
0 Kudos

HI surendra,

I am trying to write the code in view.js file:

any other way of including external libraries in the view.js file ?


Thanks,

mano.



surendra_pamidi
Contributor
0 Kudos

Hi Mano,

I think you can't add js files in view.

You are saying it is external js library. So why don't you add in index.html..? If you add in index also it is useful in view.js..

Former Member
0 Kudos

Hi,

    when an SAPUI5 App is Deployed On Fiori Launchpad, index.html will not be invoked,isn't it?

     then how to load the external  JS library?

Former Member
0 Kudos

Hi Felix,

You are right. Fiori Launchpad in HCP will not call the app's Index.html.

Did you find a solution for loading external libs?

ChandraMahajan
Active Contributor
0 Kudos

I guess you need to load the JS library. for e.g as below,

<script type='text/javascript' src='http://www.amcharts.com/wp-includes/js/jquery/jquery.js?ver=1.10.2'></script>


Regards,

Chandra

Former Member
0 Kudos

Hi,

    when an SAPUI5 App is Deployed On Fiori Launchpad, index.html will not be invoked,isn't it?

     then how to load the external  JS library?