---
title: "loadURL(_:for:completionHandler:)"
framework: webkit
role: symbol
role_heading: Instance Method
path: "webkit/wkwebextensiontab/loadurl(_:for:completionhandler:)"
---

# loadURL(_:for:completionHandler:)

Called to load a URL in the tab.

## Declaration

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

```swift
optional func loadURL(_ url: URL, for context: WKWebExtensionContext) async throws
```

## 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

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(_:) if not implemented.
