Mac Developer Library

Developer

WebKit Framework Reference WebPolicyDecisionListener Protocol Reference

Options
Deployment Target:

On This Page
Language:

WebPolicyDecisionListener

Inheritance


Not Applicable

Import Statement


Swift

import WebKit

Objective-C

@import WebKit;

Availability


Available in OS X v10.2 with Safari 1.0 and later.
Available in OS X v10.2.7 and later.

This protocol enables WebView policy delegates to communicate with listener objects. A listener object conforming to this protocol is passed as one of the arguments to web view policy delegate methods.

This protocol allows delegates to handle download decisions asynchronously. For example, the policy delegate may display a sheet, and the listener object gets notified only after the user clicks an OK or Cancel button. You do not directly create objects that conform to this protocol.

  • Tells the listener to download the resource instead of displaying it.

    Declaration

    Swift

    func download()

    Objective-C

    - (void)download

    Discussion

    This method converts a location change that may be in progress to a download operation without having to stop and restart the download. You might invoke this method based on the content’s MIME type.

    Import Statement

    Objective-C

    @import WebKit;

    Swift

    import WebKit

    Availability

    Available in OS X v10.2 with Safari 1.0 and later.

    Available in OS X v10.2.7 and later.

  • Tells the listener to ignore the resource.

    Declaration

    Swift

    func ignore()

    Objective-C

    - (void)ignore

    Discussion

    You might invoke this method to handle the resource request yourself. For example, you might want to open a new window, open a window behind the current window, open a URL in an external application, or show a file URL location in the Finder.

    Import Statement

    Objective-C

    @import WebKit;

    Swift

    import WebKit

    Availability

    Available in OS X v10.2 with Safari 1.0 and later.

    Available in OS X v10.2.7 and later.

  • Tells the listener to use the resource.

    Declaration

    Swift

    func use()

    Objective-C

    - (void)use

    Discussion

    If there are pending policy decisions, the next policy delegate method has the opportunity to decide what to do with the resource. This will be either the next navigation policy delegate (if there is a redirect), or the content policy delegate. If there are no pending policy decisions, the resource will be displayed if possible. If there is no document view available to display the resource, then the webView:unableToImplementPolicyWithError:frame: message will be sent to the web view policy delegate with an appropriate error. Invoking this method creates any new windows needed to handle the resource.

    Import Statement

    Objective-C

    @import WebKit;

    Swift

    import WebKit

    Availability

    Available in OS X v10.2 with Safari 1.0 and later.

    Available in OS X v10.2.7 and later.