on 05-12-2016 6:11 PM
Hello,
I am trying to load javascript file deployed in HCP (say for example https://xxx.dispatcher.hanatrial.ondemand.com/library/abc.js) 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>
jQuery.sap.registerModulePath("custom", "https://xxx.dispatcher.hanatrial.ondemand.com/library/abc.js");
</script>
However, I am getting the following error:
sap-ui-core.js:71 XMLHttpRequest cannot load https://xxx.dispatcher.hanatrial.ondemand.com/library/abc.js. No 'Access-Control-Allow-Origin' header is present on the requested resource. Origin 'https://callreuse-p364990trial.dispatcher.hanatrial.ondemand.com' 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 https://xxx.dispatcher.hanatrial.ondemand.com 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>
jQuery.sap.registerModulePath("custom", "/ReuseLib/library");
</script>
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?
Regards,
Faddy
Hi Faddy ,
2nd Approach by creating Destination ...
Regards,
Jibin Joy
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
Hi Jibin,
Please find the screen shot of the destination which I have created in HCP.
I have used this destination in other HCP project to load the javascript file. Though the calling app is able to get the correct url using this destination, I can see it returns "HTTP Status 405 - Bad Method" error in Network tab. If I open the file directly in browser once again, it is showing the javascript file content.
Regards,
Faddy
Hi Faddy ,
Even we have faced similar issue using basic authentication then we moved Application-to-Application SSO Authentication destination which is working as fine .
Please ensure this setting for App to App SSO
For More Information : SAP HANA Cloud Platform
Regards,
Jibin Joy
User | Count |
---|---|
89 | |
10 | |
9 | |
9 | |
9 | |
6 | |
6 | |
5 | |
5 | |
4 |
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.