---
title: "webView(_:createWebViewModalDialogWith:)"
framework: webkit
role: symbol
role_heading: Instance Method
path: "webkit/webuidelegate/webview(_:createwebviewmodaldialogwith:)"
---

# webView(_:createWebViewModalDialogWith:)

Creates a modal window containing a web view that loads the specified request.

## Declaration

```swift
optional func webView(_ sender: WebView!, createWebViewModalDialogWith request: URLRequest!) -> WebView!
```

## Parameters

- `sender`: The web view that sent the message.
- `request`: The request to load.

## Return Value

Return Value The web view that is loading the specified request.

## Discussion

Discussion This method is invoked when JavaScript calls window.showModalDialog. It should create a new modal window containing the web view and initially hide the window. The webViewRunModal(_:) message is sent to the delegate to display the web view.

## See Also

### Related Documentation

- [WebKit Objective-C Programming Guide](apple-archive/documentation/Cocoa/Conceptual/DisplayWebContent.md)

### Creating and Closing Windows

- [webViewRunModal(_:)](webkit/webuidelegate/webviewrunmodal(_:).md)
- [webView(_:createWebViewWith:)](webkit/webuidelegate/webview(_:createwebviewwith:).md)
- [webViewClose(_:)](webkit/webuidelegate/webviewclose(_:).md)
