---
title: "webView(_:requestDeviceOrientationAndMotionPermissionFor:initiatedByFrame:decisionHandler:)"
framework: webkit
role: symbol
role_heading: Instance Method
path: "webkit/wkuidelegate/webview(_:requestdeviceorientationandmotionpermissionfor:initiatedbyframe:decisionhandler:)"
---

# webView(_:requestDeviceOrientationAndMotionPermissionFor:initiatedByFrame:decisionHandler:)

Determines whether a web resource, which the security origin object describes, can access the device’s orientation and motion.

## Declaration

```swift
optional func webView(_ webView: WKWebView, requestDeviceOrientationAndMotionPermissionFor origin: WKSecurityOrigin, initiatedByFrame frame: WKFrameInfo, decisionHandler: @escaping @MainActor @Sendable (WKPermissionDecision) -> Void)
```

## Parameters

- `webView`: The web view requesting permission for orientation and motion information.
- `origin`: An object that identifies the host name, protocol, and port number for a web resource.
- `frame`: The frame that initiates the request in the web view.
- `decisionHandler`: A closure that you call from your delegate method. Pass the permission decision you determine to the closure.

## Discussion

Discussion If you don’t implement this method in your delegate, the system returns WKPermissionDecision.prompt.

## See Also

### Requesting permissions

- [webView(_:requestMediaCapturePermissionFor:initiatedByFrame:type:decisionHandler:)](webkit/wkuidelegate/webview(_:requestmediacapturepermissionfor:initiatedbyframe:type:decisionhandler:).md)
- [WKPermissionDecision](webkit/wkpermissiondecision.md)
- [WKMediaCaptureType](webkit/wkmediacapturetype.md)
