A portal can keep working when the device loses connectivity. When offline support is enabled, an offline worker installed on the device serves the portal page, its static resources and its data calls from a local cache according to a strategy you choose, shows a friendly page when a user navigates somewhere that was never cached, and queues writes made offline so they are sent as soon as the connection returns.
Offline support is off by default. You turn it on per portal.
Offline support depends on a second Visualforce page, PortalServiceWorker, being served from the portal's Site domain. Salesforce Sites only serve Visualforce pages that are listed under Setup, Sites, (your site), Site Visualforce Pages. That list is the guest profile's page access. Sites do not honour Visualforce page access granted through a permission set, so the fact that the Portals Guest permission set includes the page is not enough on its own.
Add PortalServiceWorker to Site Visualforce Pages, next to Portal:
PortalServiceWorker into the Enabled Visualforce Pages list.The 11.1 package includes the updated Portal static resource with the offline worker script. For a deployment from source, deploy that resource together with PortalServiceWorker.
If you skip this step:
/resource/ path. It now runs from this same PortalServiceWorker page, so a portal without the page enabled has no worker at all and therefore no push. See Push notifications.This step is mandatory on both a new install and an upgrade, and has to be repeated for every Site that serves a portal.
Two fields on the Web_Portal__c record, in the Offline and Caching layout section, control everything. Both are editable by users with the Portals Admin permission set. See Permission sets and access model.
| Field | Type | Default | Controls |
|---|---|---|---|
Caching_Strategy__c |
Picklist | NetworkOnly |
The strategy the offline worker applies to page, resource and data requests. NetworkOnly means offline support is off. |
Cache_Max_Age_Minutes__c |
Number | 120 | How long a cached page, asset or data response is considered fresh, and how long a page template is kept in the on device template cache. |
Picklist values:
| Value | Label |
|---|---|
NetworkOnly |
Network Only (offline support off) |
NetworkFirst |
Network First (network falling back to cache) |
StaleWhileRevalidate |
Stale While Revalidate |
CacheFirst |
Cache First (cache falling back to network) |
CacheOnly |
Cache Only |
Cache_Max_Age_Minutes__c applies to the on device page template cache regardless of which strategy is selected. Before this release that template cache was fixed at 120 minutes, so leaving the field at its default preserves the previous behaviour. A page with Disable_Caching__c ticked is still never template cached.
Offline support is registered only when both of these are true:
Caching_Strategy__c is set to something other than NetworkOnly.Internal users previewing a portal from inside the org (on the Visualforce domain) never get offline support. This keeps builder previews live and avoids caching an admin's view of a page.
The offline worker intercepts three kinds of request:
/resource/..., the app bundles, styles, branding and fonts, plus any other same origin script, stylesheet, font or image the page pulls in. That includes the platform's own /jslibrary/ scripts: without them the Visualforce remoting object is undefined and the portal page cannot build its global configuration, so nothing else on the page loads offline./services/apexrest/b3p/GlobalRemotingRouter/.| Strategy | Portal page | Static resources | Data calls |
|---|---|---|---|
| Network Only | Always from the server. No cache. | Always from the server. | Always from the server. |
| Network First | Try the server. Fall back to the cached page if the network fails. | Try the server, fall back to cache. | Try the server, fall back to the cached response if the network fails. |
| Stale While Revalidate | Serve the cached page immediately, fetch a fresh copy in the background. | Serve from cache, refresh in the background. | Answer from cache immediately, refresh in the background. If the refreshed data differs, a cache update notification fires so the component can re-render. |
| Cache First | Serve the cached page while it is younger than Cache Max Age, otherwise fetch. | Same. | Serve the cached response while it is younger than Cache Max Age, otherwise fetch. |
| Cache Only | Only ever served from cache. Never goes to the network. | Same. | Same. |
Choosing a strategy:
Cache_Max_Age_Minutes__c to match how stale you are willing to be.Passkey requests always require a connection. Settings, enrolment, sign-in, credential lists and revocation bypass browser response caches, portal data caches and offline queues, even under Cache First or Cache Only. Cached portal access does not provide offline passkey authentication. See Passkey login.
Report rows require a connection. The Report List catalogue can be cached, but opening a report loads its rows from the server. Report rows are excluded from the device cache.
Writes are never cached. Every write is sent to the network regardless of strategy. When the network is down, eligible writes are queued for background sync instead (see below).
When offline support is active, guest and community users call Apex through the REST route, /services/apexrest/b3p/GlobalRemotingRouter/, instead of Visualforce remoting. This is what allows the offline worker to see, cache and queue data traffic, because a remoting call is not an interceptable network request.
Nothing else changes:
sessionKey travels in the request body.GlobalRemotingRouter class through the Portals Guest permission set, so no extra Apex access is needed.The one environmental dependency is that the Site domain must actually serve /services/apexrest. See troubleshooting.
If a user navigates while offline to a page that was never cached, the portal shows a generic Page not available while offline page with a Retry button. This covers both a hard browser reload and in app navigation inside the portal. Retry re-attempts the navigation, so it resolves as soon as connectivity returns.
| When | Style | Message |
|---|---|---|
| The connection drops | Warning | You are offline... |
| The connection returns | Success | You are back online. |
| A write is queued because the device is offline | Info | Your change has been saved on this device and will be sent when you reconnect. |
| The queue is replayed | Success | N changes made offline have been sent. |
When the device is offline, write actions from the standard components are placed in a device local queue rather than failing.
Queued actions:
| Component | Actions |
|---|---|
| Dynamic Form, Record Data Table, Kanban Board, Calendar, Record Path | saveRecord, updateRecord, deleteRecord |
| Activity & Task Manager | saveActivity, completeActivity, reopenActivity, deleteActivity |
| Notifications Centre | markViewed, markAllViewed, dismiss |
File uploads are not queued. A file upload attempted offline fails as it did before. Ask users to retry uploads once they are back online.
How the queue behaves:
queued: true, so the user interface updates immediately.Logging out purges the offline caches on that device. This prevents one portal user's cached pages and data being served to the next person who signs in on a shared or family device.
PortalServiceWorker is not in the site's Site Visualforce Pages list. This is by far the most common cause. Permission set page access does not substitute for it./services/apexrest. In offline mode guest and community traffic uses that path instead of Visualforce remoting. Allow /services/apexrest/b3p/GlobalRemotingRouter/ on the site domain, or set the portal back to NetworkOnly until the rule is changed.Cache_Max_Age_Minutes__c, or move from Cache First to Stale While Revalidate or Network First.Disable_Caching__c ticked. With Cache Only there is no fallback at all.Portal static resource, then reload. Under Cache First or Cache Only, cached bundles are served until Cache Max Age passes, so allow for that window or lower the field temporarily during a rollout.