Progressive Web Applications
Progressive Web Applications (PWAs) offer a delivery pattern that can transform a website into an experience that feels like a native application using browser-based functionality. PWAs use web browser APIs and features along with progressive enhancement strategy. Using PWA artifacts such as a service worker, caching provisions, and a manifest file can deliver faster load times, easier navigation, and responsive behavior. PWAs allow offline capability and access to native device capabilities without writing any native code.
For more information, refer to Introduction to Progressive Web Applications and Progressive Web Applications with HCL Digital Experience (DX) 9.5.
Note
PWAs typically serve a single site. HCL DX uses virtual portals to extend PWA capabilities across multiple sites. For more information on virtual portal support, refer to Separating and sharing resources between virtual portals.
Prerequisites
Ensure the application meets these criteria before installation:
- Serve over HTTPS with a valid certificate (or use localhost for development).
-
Include a Web App manifest file that contains the following:
short_nameornameicons(must include a 192px and a 512px icon)start_urldisplay(must be eitherfullscreen,standalone, orminimal-ui)
Note
prefer_related_applicationsmust not be present, or befalse. -
Register a service worker with a functional fetch handler.
To install an application in Google Chrome that meets these criteria:
- Open the application in the browser.
-
Select Install in the address bar to open the confirmation dialog.

-
Select Install in the dialog to complete installation and launch the application.

-
Launch the application and display the icon as a Chrome application.

Architecture and scope
PWAs require correct scope configuration for both the manifest and the service worker. The web application manifest file provides information about a web application in JSON format.
The combination of modules, files, and metadata allows HCL DX 9.5 to serve files required by the PWA application and restrict which web pages users can view while applying the manifest. Navigating outside the scope reverts the application to a standard web page in a browser tab or window.
HCL DX 9.5 CF19 and Container Update CF192 add new platform and component support to add these capabilities to HCL DX 9.5 and higher sites. These include:
- System module updated in HCL DX 9.5 CF19 to serve manifest and service worker files.
- Theme scope module defined in
theme.jsonto loadpwa.js. - Page metadata created for use on the root page of the site or designated subpages.
-
Sample site configured as an installable PWA. PWA installation and display are verified on the following mobile browser platforms:
- Apple Safari on Apple mobile devices running iOS v13 and v14 (desktop access is not supported)
- Google Chrome 85 on macOS and Windows
- Microsoft Edge 85 on macOS and Windows 10
- Google Chrome 85 on Android v7 tablets and Google Pixel 3 running Android v11
- Google Chrome 86 on Linux
Note
PWA functionality is not supported on all web browser platforms (for example, Microsoft Internet Explorer 11.) Developers are encouraged to verify if PWA support is available for web browser platforms intended for use.
You can reuse file artifacts such as theme.json, pwa.js, and service-worker.js in other HCL DX 9.5 CF19 and higher themes.
-
Manifest scope defines the navigation boundary of the application and restricts accessible web pages while the manifest applies. Navigating outside the scope signals an out-of-scope state, which can disable native page operations. Set the scope directly in manifest files or by using the
com.hcl.dx.pwa.manifest.scopepage metadata parameter on the Progressive Web Application configuration node. Setting the scope value toautouses the friendly name of the page. -
Service worker scope determines which paths and files the service worker controls and intercepts. The default scope uses the directory of the service worker file and applies to all descendant directories.
Note
- When registering a service worker, you can specify a scope with a more restrictive path, but that path must be a child of the directory containing the service worker. In HCL DX, the theme path containing the service worker and the site page path reside in different hierarchies. HCL DX 9.5 defaults the scope to the friendly URL of the root label or page of the PWA site. Setting a less restrictive scope requires a
Service-Worker-Allowedheader on the service worker response. - The PWA theme module uses the friendly URL of the root page of the PWA site for theService-Worker-Allowedheader value. Set this same value as the scope when registering the service worker in the theme.
- When registering a service worker, you can specify a scope with a more restrictive path, but that path must be a child of the directory containing the service worker. In HCL DX, the theme path containing the service worker and the site page path reside in different hierarchies. HCL DX 9.5 defaults the scope to the friendly URL of the root label or page of the PWA site. Setting a less restrictive scope requires a
Authenticated and unauthenticated access
HCL DX generates URLs differently based on user authentication. Unauthenticated sites use /wps/portal/ while authenticated sites use /wps/myportal/. These URL generation differences significantly affect PWA processing. Use the site-scoped metadata parameter com.hcl.dx.pwa.app.protected to distinguish between protected and non-protected states. This parameter affects how the manifest file generates start_url and scope settings, as well as the service worker scope (/portal or /myportal) when using auto.
Setting com.hcl.dx.pwa.app.protected also alters how service-worker.js generates the PWA configuration cache key (pwaConfigCacheKey).
- When set to
false(default), the+install icon in the browser address bar displays when an unauthenticated user accesses the home page. An unauthenticated user can install the application at this point. If the user authenticates before installing the application, the+icon disappears from the address bar. - When set to
true, the+install icon does not display in the address bar until the user authenticates.
Localization
By default, the manifest.json file does not provide localization information. A single name and descriptions field sets the application name. To handle localization for HCL DX PWA applications, the following manifest.json fields extend to include an array of localized values:
descriptionsnamesshort_namesshortcuts:names-
descriptions"name": "Sample App", "names": [ { "value": "Sample application", "lang": "en" }, { "value": "Beispielanwendung", "lang": "de" } ],
In this example, if a user accesses the HCL DX PWA using German language preferences, the application name displays as Beispielanwendung. If a user accesses the application in a language that is not defined in the manifest, HCL DX uses the value from the name field as a fallback.
Hiding pages in PWA application mode
Smaller devices might not appropriately display an entire site designed for desktop. Setting the pwa.Hidden metadata to true on a page hides that page in PWA application mode.
Theme CSS implements hidden pages in two locations:
-
Add CSS to
css/default/default.cssin the static files directory. For example, to set the display mode tohiddenfor HCL DX pages in PWA application mode:@media all and (display-mode: standalone) { .pwaHidden { display: none; } } -
Update the theme navigation JSP in
themes/html/dynamicSpotsin the dynamic files directory. Whenpwa.Hiddenistrue, apply thepwaHiddenCSS class to thelielement to hide the page. For example, to add the hidden page metadata parameter tomainNav.jspin a custom theme:<c:set var="pwaHidden" value="${node.metadata['pwa.Hidden']}"></c:set> <li class="list-item <c:if test='${pwaHidden == true}'>pwaHIdden</c:if>"> <a href="$ {fn:escapeXml(node.urlGeneration.autoNavigationalState.clearScreenTemplate)}"> <c:out value="${node.title}" /> </a> </li>
Enabling PWA in an HCL DX site
-
Configure stateless URLs required for PWAs in HCL DX 9.5 CF19 and higher using one of the following methods:
-
Use the Configuration Wizard or page properties UI. For more information, refer to Defining friendly URLs without state information for pages in your site.
-
Manually configure system environment variables and theme parameters:
-
Set the following
WP_ConfigServiceresource environment variables as follows:stateless.urls.enabled=truegenerate.stateless.urls=truegenerate.stateless.redirect.urls=true
-
Update theme parameters to include:
<parameter name="com.ibm.portal.theme.hasBaseURL" type="string" update="set"><![CDATA[true]]></parameter> -
Restart the HCL DX 9.5 server.
Note
PWA installation options vary by device and browser (for example, Chrome on macOS or Safari on iOS). Steps 2 through 11 apply to custom themes or sites.
-
-
-
Create a
pwasdirectory in the root of the theme static files. This directory contains PWA configurations. Each subdirectory underpwasrepresents a single configuration. For example:pwas/ nexhaven/ images/ manifest.json service-worker.js -
Create a folder in the
pwasdirectory to represent the site configuration. -
Create a
manifest.jsonfile in the PWA configuration folder. Include the following fields:short_nameornameicons(must include a192pxand a512pxicon)scope(optional) restricts accessible web pages while applying the manifest. Navigating outside the scope signals an out-of-scope state, which can disable native page operations. Set the scope directly in the manifest file or by using thecom.hcl.dx.pwa.manifest.scopepage metadata parameter on the PWA configuration node (typically the root label or page of the site). Setting the scope value toautouses the friendly name of the page or label.start_urlspecifies the preferred URL loaded when a user launches the web application. Setstart_urldirectly in the manifest file or by using thecom.hcl.dx.pwa.manifest.start_urlpage metadata parameter on the PWA configuration node, which is typically the root label or page of the site. Setting the value toautouses the friendly name of the root page. If the root is a label,start_urldefaults to the path of the first child under that label.display(fullscreen,standalone, orminimal-ui)prefer_related_applications(must not be present, or must befalse)
-
Create a
service-worker.jsfile in the PWA configuration folder. Multiple PWA configurations can share the same service worker file. HCL DX checks forservice-worker.jsin the PWA configuration directory first. Ifservice-worker.jsis not present in that directory, HCL DX checks the rootpwasdirectory. -
Create a theme-scoped module in the
theme.jsonfile in the contributions directory in the root of the static files. This module loadspwa.jsto register the PWA service worker. For example:{ "id":"wp_theme+pwa", "prereqs": [ { "id":"wp_pwa" } ], "contributions": [ { "type":"config", "sub-contributions": [ { "type":"js", "uris": [ { "value":"/js/pwa.js" } ] } ] } ], "titles": [ { "value":"PWA support", "lang":"en" } ], "descriptions": [ { "value":"PWA support", "lang":"en" } ] }, -
Add the
pwa.jsfile referenced in the theme-scoped module to thejsdirectory in the root of the static files. Thepwa.jsfile registers the service worker with the browser. -
Add the theme-scoped module (
wp_theme_pwafromtheme.json) to the theme profiles. For example,update deferred_profile.json:"wp_one_ui", "wp_one_ui_dijit", "wp_theme_pwa" ], -
If required by your deployment, clear the theme caches using the Theme Analyzer. For more information, refer to Theme Analyzer.
-
Add metadata values to pages. For details on how
com.hcl.dx.pwa.app.protectedaffects parameter behavior, refer to Authenticated and unauthenticated access.com.hcl.dx.pwa.configuration(required): Set on the root label or page of the site to identify the PWA configuration in the themepwasdirectory. For example, set this parameter tonexhavenon the site root label.com.hcl.dx.pwa.app.protected(optional): Set on the root label or page of the site to specify whether the application applies to authenticated (true) or unauthenticated (false) site sections. Defaults tofalse.com.hcl.dx.pwa.serviceworker.scope(optional): Set on the root label or page of the site to override the service worker scope used to register the service worker with the browser (typically/wps/myportal/nexhaven). Setting the value toauto(default) sets the service worker scope to the friendly path of the PWA configuration node.com.hcl.dx.pwa.preload_urls(optional): Set on the root label or page of the site to define a comma-separated list of preloaded URLs. The service worker dynamically adds this list using thepreloadURLsvariable.com.hcl.dx.pwa.manifest.scope(optional): Set on a label or page to override thescopespecified in the PWA manifest (typically/wps/myportal/nexhaven). Setting the value toautosets the scope to the friendly path of the PWA configuration node.com.hcl.dx.pwa.manifest.start_url(optional): Set on a label or page to override thestart_urlspecified in the PWA manifest.pwa.Hidden(optional): Set on a label or page to exclude a page from PWA application navigation (trueorfalse).
-
Update theme files to hide pages in PWA application mode (optional). For more information, refer to Hiding pages in PWA application mode.
PWA support in Virtual Portals: Typically, PWAs are designed to serve a single site. Because HCL DX is capable of serving multiple sites through Virtual Portal support, HCL DX administrators should be able to configure multiple sites to implement PWA capabilities.