Contents

webView(_:runOpenPanelWith:initiatedByFrame:completionHandler:)

Displays a file upload panel.

Declaration

optional func webView(_ webView: WKWebView, runOpenPanelWith parameters: WKOpenPanelParameters, initiatedByFrame frame: WKFrameInfo, completionHandler: @escaping @MainActor @Sendable ([URL]?) -> Void)
optional func webView(_ webView: WKWebView, runOpenPanelWith parameters: WKOpenPanelParameters, initiatedByFrame frame: WKFrameInfo) async -> [URL]?

Parameters

  • webView:

    The web view that invokes the delegate method.

  • parameters:

    The parameters that describe the file upload control.

  • frame:

    The frame with the file upload control that initiates the call.

  • completionHandler:

    The completion handler the system calls after a person dismisses the open panel. Pass the selected URLs if the person selects “OK”, otherwise pass nil.

Discussion

Implement this method to customize the upload panel. To disable file uploads, implement this method to return nil.

  • By default on macOS, file uploads are disabled if you don’t implement this method.

  • By default on iOS, file uploads are enabled if you don’t implement this method.

See Also

Displaying an upload panel