---
title: "webView(_:resource:willSend:redirectResponse:from:)"
framework: webkit
role: symbol
role_heading: Instance Method
path: "webkit/webresourceloaddelegate/webview(_:resource:willsend:redirectresponse:from:)"
---

# webView(_:resource:willSend:redirectResponse:from:)

Invoked before a request is initiated for a resource and returns a possibly modified request.

## Declaration

```swift
optional func webView(_ sender: WebView!, resource identifier: Any!, willSend request: URLRequest!, redirectResponse: URLResponse!, from dataSource: WebDataSource!) -> URLRequest!
```

## Parameters

- `sender`: The web view that sent this message.
- `identifier`: An identifier object used to track the resource being loaded by dataSource.
- `request`: The request that is sent.
- `redirectResponse`: The redirect server response. If nil, there is no redirect in progress.
- `dataSource`: The data source for this web view.

## Return Value

Return Value A possibly modified request.

## Discussion

Discussion Delegates might implement this method to modify resource requests before they are sent. Note that this method might be invoked multiple times per load (as a result of a server redirect) where as the  webView(_:identifierForInitialRequest:from:) method is invoked once.

## See Also

### Loading Content

- [webView(_:resource:didFinishLoadingFrom:)](webkit/webresourceloaddelegate/webview(_:resource:didfinishloadingfrom:).md)
- [webView(_:resource:didReceive:from:)](webkit/webresourceloaddelegate/webview(_:resource:didreceive:from:)-22bdg.md)
- [webView(_:resource:didReceiveContentLength:from:)](webkit/webresourceloaddelegate/webview(_:resource:didreceivecontentlength:from:).md)
- [webView(_:resource:didFailLoadingWithError:from:)](webkit/webresourceloaddelegate/webview(_:resource:didfailloadingwitherror:from:).md)
- [webView(_:plugInFailedWithError:dataSource:)](webkit/webresourceloaddelegate/webview(_:pluginfailedwitherror:datasource:).md)
