---
title: "evaluateURL(_:mainDocumentURL:completionHandler:)"
framework: browserenginekit
role: symbol
role_heading: Instance Method
path: "browserenginekit/bewebcontentfilter/evaluateurl(_:maindocumenturl:completionhandler:)"
---

# evaluateURL(_:mainDocumentURL:completionHandler:)

## Declaration

```swift
func evaluateURL(_ url: URL, mainDocumentURL: URL?, completionHandler: @escaping @Sendable (Bool, Data?) -> Void)
```

```swift
func evaluateURL(_ url: URL, mainDocumentURL: URL?) async -> (Bool, Data?)
```

## Parameters

- `url`: The URL to be evaluated.
- `mainDocumentURL`: The URL of the main document, also the root URL of the transitive trust policy
- `completionHandler`: The completion block to be invoked when evaluation is complete.

## Discussion

Discussion Evaluates whether a URL should be blocked and if yes, provides a response body representing the HTML of the blocking content that will be displayed in either the blocked main document or blocked subframe.
