Skip to Content
May 12, 2016 at 05:11 PM

How to load external .js file in Web IDE



I am trying to load javascript file deployed in HCP (say for example in my Web IDE UI5 application. I am able to access the js directly using the above url. I tried with two approaches, but nothing worked.

Approach 1: Mentioned the following in index.html

<script>"custom", "");


However, I am getting the following error:

sap-ui-core.js:71 XMLHttpRequest cannot load No 'Access-Control-Allow-Origin' header is present on the requested resource. Origin '' is therefore not allowed access. The response had HTTP status code 404.

Approach 2: I have created an destination (named ReuseControl) in HCP cockpit using and referred it neo-app.json.


"path": "/ReuseLib",

"target": {

"type": "destination",

"name": "ReuseControl"


"description": "Test"


When I tried to use it in index.html as:

<script>"custom", "/ReuseLib/library");


and referred abc.js using the alias "custom", it says that the .js file is not found though I can see the abc.js file Network tab of chrome. If I open abc.js from Network tab, it says: HTTP Status 405 - Bad Method. If I refresh the page again, I can see abc.js content in browser.

My question is: What should be the ideal approach to load external .js file in UI5 application developed using WEB IDE? Can you please suggest a way to make the above scenario working?