<!--
{
  "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/WKWebExtensionTab/loadURL(_:for:completionHandler:)",
  "metadataVersion" : "0.1.0",
  "role" : "Instance Method",
  "symbol" : {
    "kind" : "Instance Method",
    "modules" : [
      "WebKit"
    ],
    "preciseIdentifier" : "c:objc(pl)WKWebExtensionTab(im)loadURL:forWebExtensionContext:completionHandler:"
  },
  "title" : "loadURL(_:for:completionHandler:)"
}
-->

# loadURL(_:for:completionHandler:)

Called to load a URL in the tab.

```
optional func loadURL(_ url: URL, for context: WKWebExtensionContext, completionHandler: @escaping ((any Error)?) -> Void)
```

## Parameters

`url`

The URL to be loaded in the tab.

`context`

The context in which the web extension is running.

`completionHandler`

A block that must be called upon completion. It takes a single error argument, which should be provided if any errors occurred.

## Discussion

If the tab is already loading a page, calling this method should stop the current page from loading and start loading the new URL. Loads the URL in the tab’s web view via [`load(_:)`](/documentation/WebKit/WKWebView/load(_:)-5siv6) if not implemented.

---

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)