---
title: "onOpenURL(prefersInApp:)"
framework: swiftui
role: symbol
role_heading: Instance Method
path: "swiftui/view/onopenurl(prefersinapp:)"
---

# onOpenURL(prefersInApp:)

Sets an OpenURLAction that prefers opening URL with an in-app browser. The handler closure takes a URL as input, and returns a OpenURLAction.Result that indicates the outcome of the action.

## Declaration

```swift
@MainActor @preconcurrency func onOpenURL(prefersInApp: Bool) -> some View

```

## Parameters

- `prefersInApp`: A boolean value that specifies whether to prefer to open the URL with an in-app browser or not.

## Discussion

Discussion It’s equivalent to calling .onOpenURL(_:) .onOpenURL { _ in     .systemAction(prefersInApp: prefersInApp) }

## See Also

### URLs

- [onOpenURL(perform:)](swiftui/view/onopenurl(perform:).md)
- [widgetURL(_:)](swiftui/view/widgeturl(_:).md)
