Loading External JS in SAP Fiori all pages

883 views Asked by At

We have a software that runs as an overlay on existing applications, SAP Fiori being one of them. We need to ask our client to include the CDN hosted JavaScript on all application pages. As I understand this might mean the js needs to be included in all Fiori app component.js or index.html.

Is there a way, to load the CDN hosted script on All SAP Fiori Apps pages including launchpad?

I am new to the SAP world and my research only got me so far. Appreciate any help.

1

There are 1 answers

0
Sergei Ukolov On

You need to create Fiori plug-in (using SAP WebIDE). Tutorial

File Component.js:

sap.ui.define([
    "sap/ui/core/Component",
], function (Component) {

    return Component.extend("cdntest.Component", {

        metadata: {
            "manifest": "json"
        },

        init: function () {
            let cdnScript = document.createElement('script');
            cdnScript.setAttribute('src', 'https://ajax.googleapis.com/ajax/libs/jquery/3.2.1/jquery.min.js');
            document.head.appendChild(cdnScript);

        }

    });
});

enter image description here