Instance Method

setURLSchemeHandler(_:forURLScheme:)

Adds a URL scheme handler object for a given URL scheme.

Declaration

func setURLSchemeHandler(_ urlSchemeHandler: WKURLSchemeHandler?, forURLScheme urlScheme: String)

Parameters

urlSchemeHandler

The handler to register.

scheme

The URL scheme the object handles.

Discussion

Each URL scheme can only have one handler. An exception is thrown if you register a handler for an invalid URL scheme, if you register a handler for a URL scheme more than once, or if you register a handler for a URL scheme already handled by WebKit. You can call the handlesURLScheme(_:) method to determine whether WebKit handles a particular URLs scheme.URL schemes are case insensitive. Valid URL schemes must start with an ASCII letter and can only contain ASCII letters, numbers, the '+' character, the '-' character, and the '.' character.

See Also

Adding Handlers for New URL Schemes

func urlSchemeHandler(forURLScheme: String) -> WKURLSchemeHandler?

Returns the currently registered scheme handler for the given URL scheme