Skip to content


Presents websites and evaluates JavaScript on websites.

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.

The web view also supports evaluating JavaScript on a website.


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

-new WebView

Constructs web view.

Constructs a new web view. Use a web view to evaluate JavaScript on websites.

new WebView()


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.

The optional 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


Evaluates JavaScript in the web view.

Evaluates JavaScript in the current context of the web view. The returned promise carries the result of evaluating the JavaScript.

When passing false to the useCallback parameter, which is the default value, evaluation will terminate after evaluating the last line of the JavaScript. The value on the last line of the script will be carried by the promise returned by evaluateJavaScript.

When passing true to the useCallback parameter, evaluation will only complete after the globally available completion function is called. Any value passed to the function, will be carried by the promise returned by evaluateJavaScript.

The log is available from the evaluated JavaScript, i.e. messages passed to the globally available log and logError functions will be shown in the log.

evaluateJavaScript(javaScript: string, useCallback: bool): Promise<any>


Reads and returns HTML from the loaded website.

getHTML(): Promise<any>


Presents the web view.

The web view is presented with the content that has been loaded into it.

present(): Promise


Waits for the web view to load.

The returned promise will be fulfilled when the web view finishes loading. If the load fails, the promise will be fulfilled with an error. Use this with caution. If the web view is not loading a new page or is not about to load a new page, the returned promise will never be fulfilled. This limitation exists because Scriptable cannot determine if a web view is about to load a page in cases where evaluating JavaScript in the web view causes a new page to load.

Generally this should only be used when loading causing a new page to load from evaluateJavaScript. In other cases, e.g. when loading a URL using loadURL, the returned promise will be fulfilled when the page have been loaded.

waitForLoad(): Promise<any>