<!--
{
  "availability" : [
    "iOS: 10.0.0 - 13.0.0",
    "iPadOS: 10.0.0 - 13.0.0",
    "macCatalyst: 13.1.0 - 13.1.0",
    "visionOS: 1.0.0 - 1.0.0"
  ],
  "documentType" : "symbol",
  "framework" : "WebKit",
  "identifier" : "/documentation/WebKit/WKUIDelegate/webView(_:shouldPreviewElement:)",
  "metadataVersion" : "0.1.0",
  "role" : "Instance Method",
  "symbol" : {
    "kind" : "Instance Method",
    "modules" : [
      "WebKit"
    ],
    "preciseIdentifier" : "c:objc(pl)WKUIDelegate(im)webView:shouldPreviewElement:"
  },
  "title" : "webView(_:shouldPreviewElement:)"
}
-->

# webView(_:shouldPreviewElement:)

Determines whether the given element should show a preview.

```
optional func webView(_ webView: WKWebView, shouldPreviewElement elementInfo: WKPreviewElementInfo) -> Bool
```

## Parameters

`webView`

The web view invoking the delegate method.

`elementInfo`

The information associated with the element.

## Return Value

Return `NO` to disable previews for the given element.

## Discussion

This method is only invoked for elements that have a default preview in WebKit.

---

Copyright &copy; 2026 Apple Inc. All rights reserved. | [Terms of Use](https://www.apple.com/legal/internet-services/terms/site.html) | [Privacy Policy](https://www.apple.com/privacy/privacy-policy)