<!--
{
  "availability" : [
    "iOS: 11.0.0 -",
    "iPadOS: 11.0.0 -",
    "macCatalyst: 13.1.0 -",
    "macOS: 10.13.0 -",
    "visionOS: 1.0.0 -"
  ],
  "documentType" : "symbol",
  "framework" : "WebKit",
  "identifier" : "/documentation/WebKit/WKURLSchemeHandler",
  "metadataVersion" : "0.1.0",
  "role" : "Protocol",
  "symbol" : {
    "kind" : "Protocol",
    "modules" : [
      "WebKit"
    ],
    "preciseIdentifier" : "c:objc(pl)WKURLSchemeHandler"
  },
  "title" : "WKURLSchemeHandler"
}
-->

# WKURLSchemeHandler

A protocol for loading resources with URL schemes that WebKit doesn’t handle.

```
@MainActor protocol WKURLSchemeHandler : NSObjectProtocol
```

## Overview

Adopt the [`WKURLSchemeHandler`](/documentation/WebKit/WKURLSchemeHandler) protocol in objects that handle custom URL schemes for your web content. Custom schemes let you integrate custom resource types into your web content, and you may define custom schemes for resources that your app requires. For example, you might use a custom scheme to integrate content that is available only on the user’s device, such as the user’s photos. Adopt this protocol in one of your app’s objects and register it using the [`setURLSchemeHandler(_:forURLScheme:)`](/documentation/WebKit/WKWebViewConfiguration/setURLSchemeHandler(_:forURLScheme:)) method of [`WKWebViewConfiguration`](/documentation/WebKit/WKWebViewConfiguration).

When a web view encounters a resource that uses a custom scheme, it creates a [`WKURLSchemeTask`](/documentation/WebKit/WKURLSchemeTask) object and passes it to the methods of your scheme handler object. Use the [`webView(_:start:)`](/documentation/WebKit/WKURLSchemeHandler/webView(_:start:)) method to begin loading the resource. While your handler loads the object, the web view may call your handler’s [`webView(_:stop:)`](/documentation/WebKit/WKURLSchemeHandler/webView(_:stop:)) method to notify you that the resource is no longer needed.

## Topics

### Loading a Custom Resource

[`webView(_:start:)`](/documentation/WebKit/WKURLSchemeHandler/webView(_:start:))

Asks your handler to begin loading the data for the specified resource.

### Responding to a Canceled Resource Request

[`webView(_:stop:)`](/documentation/WebKit/WKURLSchemeHandler/webView(_:stop:))

Asks your handler to stop loading the data for the specified resource.



---

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)
