How to download files?

Sometimes a web page may trigger a download (for example, in response to the user clicking a download link). This page describes how to enable and handle such downloads.

IWithDownloads

With the exception of 2D WebView for WebGL (covered separately in the section below), downloads are handled using the IWithDownloads interface. Downloads are disabled by default, but an application can use IWithDownloads to enable and handle download events. Please note that IWithDownloads is currently supported on Windows, macOS, and Android, but isn't supported yet on iOS or UWP. If you need download support on iOS or UWP, please contact me.

2D WebView for WebGL

2D WebView for WebGL doesn't support IWithDownloads, but downloads are instead enabled by default using the browser's built-in download functionality. For example, a web page can use a link with a download attribute to trigger a download. Please note that downloads are subject to the browser's security rules. For example, the "download" attribute only works for same-origin URLs, or the blob: and data: schemes. For more details on security limitations, please see this page.