Show TOC

Using the Global Configuration Object for ConfigurationLocate this document in the navigation structure

The global configuration object is a property in the global window object with property name sap-ui-config. The property must be a simple object, where each property represents the configuration option of the corresponding name.

The name of the window property intentionally is not a valid JavaScript identifier. This helps to avoid conflicts with typical JavaScript coding and the structured nature of the name is intended to avoid conflicts with SAP objects. To define the object, quotes must be used.

If a configuration option has a name that is not a valid JavaScript identifier or that is a reserved token in JavaScript, the property name in the configuration object must be quoted. Currently, such a configuration option does not exist.

As the configuration is evaluated during bootstrap, the configuration object must be created before SAPUI5 is booted. Otherwise, the contained configuration cannot be evaluated. As a consequence, using the global configuration object requires another script tag in front of the bootstrap script tag. It is up to the application whether it uses an inline script tag or a separate JavaScript file, which is loaded via a script tag, for this purpose. If you use a dedicated file, it may require more work initially, but offers the following advantages:

  • Several pages can share the file and, thus, use the same configuration.

  • The Content Security Policy (CSP) mechanism as introduced, for example, by Firefox 4.0 and others requires the use of a file.

The following code snippet shows an example for an inline script tag:

	<script type="text/javascript">
		window["sap-ui-config"] = {
			theme : "sap_platinum",
			libs : "sap.ui.commons",
	<script id="sap-ui-bootstrap" 

This option requires an additional script or script tag, but it offers the following advantages:

  • Possibility to share configuration between pages

  • Can be used in environments where the scrip tag cannot be influenced, for example, because it is created out of some configuration, like in some mashup frameworks

  • Allows to provide configuration before the core boots