---
sourceDocument: Australia API Reference
sourceDocumentLink: https://servicenow-prod.fluidtopics.net/r/api-reference

 Release :

    - australia

ft:locale :

    - en-US

ft:publication_title :

    - Australia API Reference

ft:clusterId :

    - crapiref

bundleId :

    - crapiref

workflow :

    - Creator


---

# Display web pages hosted on your ServiceNow instance

# Display web pages hosted on your ServiceNow instance {#ariaid-title1}

Release version: Australia  
Updated March 12, 2026  
![](https://www.servicenow.com/docs/portal-asset/ico-clock) 3 minutes to read
Summarize  
![AI sparkle icon](https://servicenow.com/docs/portal-asset/ai-sparkle-icon) Summarized using AI  
This content was generated using new OpenAI-powered functionality. Results are provided on an as is basis and are not guaranteed to be accurate or complete.  

## Summary of Display Web Pages Hosted on Your ServiceNow Instance

This feature enables you to display web pages hosted on your ServiceNow instance within a native iOS application.
Utilizing the Mobile SDK, it simplifies authentication and session management while allowing dynamic interactions on the ServiceNow platform.
Show full answer Show less  

## Key Features

* **Authentication and Session Management:** The NowWebService API manages user sessions using OAuth access tokens and cookies for validation.
* **Web Page Loading:** The NowWebViewController handles loading the web pages, creating HTTP requests with the necessary headers.
* **Session Expiry Handling:** If a session expires due to inactivity, users are redirected to the login page, and a new session is initiated automatically.
* **Creating Web Services:** Initiate a NowWebService instance by calling the makeWebService() method with your ServiceNow instance URL and an initialized NowSDK.
* **Preloading Pages:** Enhance load times by preloading pages with cacheable resources using the preloadWebCache() function.
* **Custom Views:** Create views to display web content using NowWebViewController and customize the web UI with themes.

## Key Outcomes

By implementing these features, ServiceNow customers can seamlessly integrate and display dynamic web content in their iOS applications, improve user experience through faster load times, and maintain consistent branding by theming the web interface. Proper session management ensures users have a smooth experience, reducing interruptions due to session timeouts.  
You can display web pages hosted within your ServiceNow instance
in your native iOS application.
The Mobile SDK provides seamless handling of the required authentication and
session management, while the [NowWebService](https://servicenow-prod.fluidtopics.net/azd9OsniOWvfEzBB6fAujw#NowWebServiceiOSAPI "The NowWebService class provides functions that enable the browsing of web pages on a ServiceNow instance.") API provides the functionality required to handle pages residing on
your ServiceNow instance. These web pages have all the dynamic
interactions that are possible on the ServiceNow platform.

When the webview is requested to load a web page hosted on a ServiceNow instance, it creates an HTTP request with the appropriate bearer header containing the
OAuth access token provided by the NowSDK. When the instance receives this request, it
starts a new user session and returns cookies related to that session. As the user interacts
with the web pages in the webview, the instance uses the cookies to validate that the
session is still valid. At this point, the bearer header is no longer relevant, only the
cookies are used for session validation. The web session expires if the user stops
interacting with the website for longer than the timeout period. After the session expires,
if the user tries to interact with the web page, they are automatically redirected to the
login page. The NowWebViewController detects the redirection and attempts to start a new web
session by requesting a refreshed access token from the NowSDK and using the token to create
a HTTP request (with bearer header) for the last known loaded page.

To use these features, you must first create an instance of the
NowWebService. To do this you must call the
makeWebService() method and provide the URL to your ServiceNow instance and an already initialized `NowSDK`.
In addition, you must have imported `NowWeb` within your application. You
should hold a reference to the NowWebService for as long as you are using
the `NowWeb` service.

The following shows an example of how to create a NowWebService object using async/await:  

    do {
        let service = try await NowWeb.makeWebService(instanceUrl: instanceUrl)
        self.webService = service
    } catch {
        debugPrint("Web Service creation failed with error: \(error.localizedDescription)") 
    }

The following shows an example of how to create a NowWebService object using a completion
handler:

    import Combine
    import NowWeb
    import UIKit
    ...
    public func makeWebService(instanceUrl: URL, 
      completion: @escaping ((Result<NowWeb.NowWebService, NowSDK.NowServiceError>) -> Void)) 

## Pre-load pages to improve NowWeb load time

You can pre-load pages with cacheable resources in the background to improve initial NowWeb load times. The following example shows how to use the webService.preloadWebCache() function to
pre-load specified pages.

    private func preloadURLs(urls: [URL]) {
      guard let webService = webService else {
        debugPrint("Web service not initialized")
        return
      }
      do {
           try webService.preloadWebCache(urls: urls) {
             debugPrint("URLs did complete preloading")
           }
                
      } catch {
          debugPrint(error.localizedDescription)
      }
    }

## Create views to display web content {#mobsdk-ios-display-web-pages__section_k5l_c11_kqb}

Once you have instantiated an instance of NowWebService, you can use it to create views to
display web pages hosted on your ServiceNow instance.

The following example shows how to create a [NowWebViewController](https://servicenow-prod.fluidtopics.net/Jy3_ttHPo5en4spXJi_mBA#NWebViewControlleriOSAPI "The NowWebViewController class provides functions that enable you to manage a web viewer.") view:  

    let result = webService.makeWebViewController(for: url, 
      delegate: self, theme: MyWebTheme(nowUITheme: MyUITheme()))
    switch result { 
    case .success(let viewController): 
      return viewController 
    case .failure(let error): 
      debugPrint("Web view creation failed with error: \(error.localizedDescription)") 
    }

In this example, url is the URL of the initial page to load within the view. This URL must point to a page that is hosted on the specified ServiceNow instance. Relative URLs also work and are relative to the ServiceNow instance targeted by the NowWebService.

Once created, you can push the NowWebViewController onto an existing navigation stack. The
initial page is not loaded until you call the [loadPage()](https://servicenow-prod.fluidtopics.net/Jy3_ttHPo5en4spXJi_mBA#NWVC-loadPage "If the request is authenticated, starts loading the initial URL provided during instantiation using the makeWebViewController() method.") method.

## Theme the web user interface {#mobsdk-ios-display-web-pages__section_mvp_5c1_kqb}

You can customize the colors of the web UI by passing a theme object in the makeWebViewController() call. For a list of all of the elements that you can customize, see [NowWebColoring protocol - iOS](https://servicenow-prod.fluidtopics.net/lPfOERM43jVe~CFdWcYZSg "The NowWebColoring protocol provides default values for the colors used within web pages hosted on your ServiceNow instance in a native web view."). By default, the web UI uses the NowUIColor theme for all NowSDK UI elements. Refer to the [NowWebThemeable protocol - iOS](https://servicenow-prod.fluidtopics.net/zp0g_~mDxE8oqOQk9vq3Dg "The NowWebThemeable protocol provides properties that enable you to override the colors used within web pages hosted on your ServiceNow instance in a native web view.") for sample code snippets on how to apply a theme to your web UI.

