Supports rendering HTML as well as loading a file and rendering it. A file can be of various types. It could for example be an HTML file or an image.
Function called upon load of a request.
When the web view performs a request to load a resource, the function can determine whether or not to allow the request. Disallowing request can speed up the time it takes to load the website.
By default all requests are allowed.
shouldAllowRequest: fn(Request) -> bool
Constructs web view.
Loads HTML and renders it.
static loadHTML(html: string, baseURL: string, preferredSize: Size): Promise
Loads a file and renders it.
Files can be of various types, including HTML files and images.
The supplied HTML file can reference files and nested directories in the same directory as the HTML file resides.
preferredSize parameter is ignored unless the script is run in a Siri Shortcut.
If you are displaying large images in a memory constrained envrionment, for example in a Siri Shortcut, you should use the WebView bridge instead of the QuickLook bridge. The technical reason for this is that a Siri Shortcut and other app extension processes have very limited memory and loading a very large image will cause the app extension to be terminated. However, the web view will run in a different process meaning that it is not affected by the same memory constraints.
static loadFile(fileURL: string, preferredSize: Size): Promise
Loads URL in web view.
Loads the URL in the web view. The returned promise will complete once the web view have finished loading.
loadURL(url: string): Promise
Loads request in web view.
When loading a request into the web view, the HTTP method, body and headers of the request will be respected. The onRedirect function on the request will not be invoked.
loadRequest(request: Request): Promise
Loads HTML in web view.
Loads the HTML into the web view. The returned promise will complete once the web view have finished loading.
loadHTML(html: string, baseURL: string): Promise
Reads and returns HTML from the loaded website.
Presents the web view.
The web view is presented with the content that has been loaded into it.
Waits for the web view to load.
Generally this should only be used when loading causing a new page to load from
the returned promise will be fulfilled when the page have been loaded.