Downloads a File.
The URL of the File to Download.
Downloads a File.
Visual Basic |
---|
Public Sub Download( _ ByVal url As String _ ) |
The URL of the File to Download.
Download method will start downloading of a resource defined by the URL. During file download the OnBeforeDownload event is fired once, followed by OnDownloadUpdated events, until the resource if fully downloaded or cancelled. To set the local Path and FileName of the resource being downloaded you need to handle OnBeforeDownload and set the relevant parameters. You may cancel the download of the resource by handling OnBeforeDownload and setting Cancel parameter to True.
You can set the Path and FileName or cancel the download by calling SetDownloadPath method while in OnBeforeDownload event. This is best practice for programming languages that cannot handle ByRef arguments. You can define a master download path for all your downloads by handling OnCreate event and setting Settings.default_download_path to your downloads folder.
If the resource is loaded from the Cache then OnBeforeDownload and OnDownloadUpdated events will not fire. You can control cache by handling OnCreate event and setting Settings.cache_path folder. You are advised to use a different WebKitX control instance for downloading resources with its own cache that you should delete once the resource is downloaded.
If the resource is of type PDF and the Plugins are enabled, the document will be loaded in PDF Viewer instead of downloaded; in this case no download events are fired. To download PDF files you need to create WebKitX browser without enabling any plugins. To do that you need to handle the OnCreate event and set Settings.plugins = false and append --disable-pdf-extension=1 in OnCreate command line switches.