<!--
{
  "availability" : [
    "iOS: 18.4.0 -",
    "iPadOS: 18.4.0 -",
    "macCatalyst: 18.4.0 -",
    "macOS: 15.4.0 -",
    "visionOS: 2.4.0 -"
  ],
  "documentType" : "symbol",
  "framework" : "WebKit",
  "identifier" : "/documentation/WebKit/WKWebExtensionContext/loadBackgroundContent(completionHandler:)",
  "metadataVersion" : "0.1.0",
  "role" : "Instance Method",
  "symbol" : {
    "kind" : "Instance Method",
    "modules" : [
      "WebKit"
    ],
    "preciseIdentifier" : "c:objc(cs)WKWebExtensionContext(im)loadBackgroundContentWithCompletionHandler:"
  },
  "title" : "loadBackgroundContent(completionHandler:)"
}
-->

# loadBackgroundContent(completionHandler:)

Loads the background content if needed for the extension.

```
func loadBackgroundContent(completionHandler: @escaping ((any Error)?) -> Void)
```

## Parameters

`completionHandler`

A block to be called upon completion of the loading process, with an optional error.

## Discussion

This method forces the loading of the background content for the extension that will otherwise be loaded on-demand during specific events.

It is useful when the app requires the background content to be loaded for other reasons. If the background content is already loaded, the completion handler will be called immediately. An error will occur if the extension does not have any background content to load or loading fails.

---

Copyright &copy; 2026 Apple Inc. All rights reserved. | [Terms of Use](https://www.apple.com/legal/internet-services/terms/site.html) | [Privacy Policy](https://www.apple.com/privacy/privacy-policy)