Skip to Content

Archived discussions are read-only. Learn more about SAP Q&A

Global JS Object in Launchpad

Hello everyone,

in our company we started to deploy some fiori apps into the launchpad. Now we want these apps to share some data and functionality via a global Javascript Object inside the Launchpad. What is the best way to achieve that? Maybe via modules?

We tried it so far the "normal" JS-way: window.myGlobal = ... in the Component.js - file on one of the apps. But the first problem is, the file is only executed, if the app gets started and the second problem is that we can't access the variable in another app. It is undefined, although all apps share the same window object: How to get your SAP UI 5 apps to work like SAP Fiori Apps in SAP Fiori Launchpad.

All ideas are welcome.

Thanks in advance,


Edit: I found out so far, that the apps are executed inside an iframe and so they do not share the same window object.

Former Member
Former Member replied

Hello Pruthvi,

you're absolutly right in general. But in our scenario it is necessary that the apps share data on client side, because sometimes the state of one app depends on the state of another app.

The solution in our case was to deploy the app as components, not as standalone apps inside launchpad via the index.html. The problem is, although Component.js and index.html share the same folder at development time they are in different folders on runtime. So we had to find the right path. It is a bit confusing, but here the concret example:

Works: <host:port>/sap/bc/bsp/sap/myapp/index.html

Works NOT: <host:port>/sap/bc/bsp/sap/myapp/Component.js

Works: <host:port>/sap/bc/ui5_ui5/sap/myapp/Component.js

So now the app no longer running as iframes inside the launchpad and share the same window object.

Problem solved.



0 View this answer in context
Not what you were looking for? View more on this topic or Ask a question