Platforms to show: All Mac Windows Linux Cross-Platform

WebDownloadDelegateMBS class

Type Topic Plugin Version macOS Windows Linux Console & Web iOS
class HTMLViewer Mac MBS MacControls Plugin 11.3 Yes No No Yes, macOS only No
Function: The class for receiving events about downloads running in a htmlviewer/webviewer.
The NSURLDownloadDelegate protocol defines methods that allow an object to receive informational callbacks about the asynchronous load of a download's URL request. Other delegate methods provide facilities that allow the delegate to customize the process of performing an asynchronous URL load.

Note that these delegate methods will be called on the thread that started the asynchronous load operation for the associated NSURLDownload object.

  • A didBegin message will be sent to the delegate immediately upon starting the download.
  • Zero or more willSendRequest messages will be sent to the delegate before any further messages are sent if it is determined that the download must redirect to a new location. The delegate can allow the redirect, modify the destination or deny the redirect.
  • Zero or more didReceiveAuthenticationChallenge messages will be sent to the delegate if it is necessary to authenticate in order to download the request and NSURLDownload does not already have authenticated credentials.
  • Zero or more didCancelAuthenticationChallenge messages will be sent to the delegate if NSURLDownload cancels the authentication challenge due to encountering a protocol implementation error.
  • Zero or more didReceiveResponse messages will be sent to the delegate before receiving a didReceiveDataOfLength message. The only case where didReceiveResponse is not sent to a delegate is when the protocol implementation encounters an error before a response could be created.
  • Zero or more didReceiveDataOfLength messages will be sent before didFinish or didFailWithError is sent to the delegate.
  • Zero or one decideDestinationWithSuggestedFilename will be sent to the delegate when sufficient information has been received to determine the suggested filename for the downloaded file. The delegate will not receive this message if setDestination has already been sent to the NSURLDownload instance.
  • A didCreateDestination message will be sent to the delegate when the NSURLDownload instance creates the file on disk.
  • If NSURLDownload determines that the downloaded file is in a format that it is able to decode (MacBinary, Binhex or gzip), the delegate will receive a shouldDecodeSourceDataOfMIMEType. The delegate should return true to decode the data, false otherwise.
  • Unless an NSURLDownload instance receives a cancel message, the delegate will receive one and only one didFinish or didFailWithError: message, but never both. In addition, once either of messages are sent, the delegate will receive no further messages for the given NSURLDownload.

Please use one delegate class per HTMLViewer (or WebViewMBS) and make sure they live about the same time. Our class keeps a reference on the WebView, so we can remove our delegate when the delegate is destroyed.

Feedback, Comments & Corrections

This class has no sub classes.

Some useful global functions for this class:

Some methods using this class:

Some examples which use this class:

Blog Entries

The items on this page are in the following plugins: MBS MacControls Plugin.

WebDocumentViewMBS   -   WebFrameLoadDelegateMBS

The biggest plugin in space...

MBS Xojo tutorial videos