Contents

load(_:mimeType:characterEncoding:baseURL:)

Loads the content of the specified data object and navigates to it.

Declaration

@discardableResult @MainActor final func load(_ data: Data, mimeType: String, characterEncoding: String.Encoding, baseURL: URL) -> some AsyncSequence<WebPage.NavigationEvent, any Error>

Parameters

  • data:

    The data to use as the contents of the webpage.

  • mimeType:

    The MIME type of the information in the data parameter. This parameter must not contain an empty string.

  • characterEncoding:

    The data’s character encoding.

  • baseURL:

    A URL that you use to resolve relative URLs within the document.

Return Value

An async sequence you use to track the loading progress of the navigation. If the Task enclosing the sequence is cancelled, the page will stop loading all resources.

Discussion

Use this method to navigate to a webpage that you loaded yourself and saved in a data object. For example, if you previously wrote HTML content to a data object, use this method to navigate to that content.

See Also

Loading web content