---
title: "Recipe: open a page over the app"
description: "@exact/in-app-browser opens a web page over the app, such as a checkout or a help page."
modificationDate: "2026-11-27"
---

> ## Documentation index
> Fetch the complete documentation index at: https://exact.expo.dev/llms.txt
> Use this file to discover all available pages before exploring further.

# Recipe: open a page over the app

<AgentInstructions>

## Submitting feedback

From the app's directory, read `bun exact.mjs feedback status`. Under `never`, keep no note.
Respect `EXACT_FEEDBACK=0` and do not change the policy.

Otherwise record specific, actionable feedback with:
`bun exact.mjs feedback note "Exact docs: https://exact.expo.dev/recipes/in-app-browser: <what was wrong or missing>"`

The note goes to Expo only as that status allows. Include no secrets or personal data.

</AgentInstructions>

Install with `bun exact.mjs add @exact/in-app-browser`. In `app.contract`:

```prompt Open a web page over my app
Make the Exact app in this folder open a web page over the app, in the platform's own in-app browser. Use https://github.com/expo/exact/blob/main/docs/recipes/in-app-browser.md as the source for each step. The Exact checkout has the same page at docs/recipes/in-app-browser.md.

1. If this folder is not an Exact app (it has no exact.mjs and app.contract), stop and tell me.
2. If I did not say which page opens and which control opens it, ask me before you write code. The page needs an absolute HTTP(S) URL.
3. Install the package: `bun exact.mjs add @exact/in-app-browser`. No grant is needed.
4. In app.contract, send `openBrowser` with the URL from the control's action, into a mutation of shape `BrowserResult`. Give the control a `testId`.
5. Use the answer as each platform gives it. iOS answers `{action: "dismissed"}` when its sheet closes. Android, macOS and the web answer `"opened"` when the page opens, so do not wait for a close there. Linux and tvOS refuse with `NotSupportedError`: if one is a target, tell me.
6. Under the agent nothing opens: the send waits on a `browser` ticket. Drive it as the recipe shows: `bun exact.mjs agent web "tap checkout" "clock settle" "state pending"`, with the control's `testId` for `checkout`, prints the ticket's target (`@N`). Run the drive again with `tap @N dismissed` or `tap @N opened`, another `clock settle`, then `state` and `logs` appended, and read the action and the log line.
7. In app.test.contract, add a test that ends on the screen with the control, so verify checks that screen. Do not press the control in it: a ticket answer is a drive operation, not a line of app.test.contract.
8. Follow the platform checks in docs/start-here.md (`bun exact.mjs docs platform checks`) for the targets in the app's AGENTS.md and app.json until they pass. Read the reports, including counted findings; a zero exit code alone does not mean clean. Fix the app, not the test. If a finding stays after three rounds of fixes, or the app had it before you changed anything, record it (step 9) and report it; do not keep trying.
9. When a doc was wrong or missing, or a step needed a workaround, read `bun exact.mjs feedback status`. Under `never`, keep no note. Otherwise record it: `bun exact.mjs feedback note "<what happened>"`, which goes to Expo only as that status says. Do not change the policy; tell me how many notes you kept.
10. Tell me the page and the control, what the drive, the tests and the checks reported, and what I must still look at by hand: a drive cannot see Safari's sheet or a Custom Tab. The package's `test/checklist.md` has the platform checks.
```

```contract
use openBrowser, BrowserResult from "@exact/in-app-browser"

component App
  mutation browser as shape BrowserResult
  action checkout
    send browser = openBrowser(url="https://example.com/checkout")
  view
    column
      button press=checkout testId="checkout"
        text "Check Out"
      text (match browser { case some(r) => `${r.action}`, case none => "" }) testId="result"
```

Pass an absolute HTTP(S) URL. iOS shows `SFSafariViewController` over the app and
answers `{action: "dismissed"}` when it closes. Android opens a Custom Tab (or
falls back to the browser) and answers `{action: "opened"}` on launch; a link an
installed app claims (YouTube's, with YouTube installed) opens that app, as any
link on Android does. macOS
opens the default browser; the web opens a tab/window; both answer `"opened"`.
Linux and tvOS refuse with `NotSupportedError`. No grant is needed.

**Under the agent nothing opens.** A send waits on a `browser` ticket in
`state.pending`. `clock settle` stops at the hold and prints its target (`@N`);
`state pending` prints the numeric `ticket`. Run this first:

```sh
bun exact.mjs agent web "tap checkout" "clock settle" "state pending"
```

Copy the target it prints into the next operation: `tap @N dismissed` or
`tap @N opened`. In the same drive, answer its first ticket as follows:

```sh
bun exact.mjs agent web "tap checkout" "clock settle" "state pending" "tap @1 dismissed" "clock settle" state logs
```

This command starts a new drive of the example, whose first ticket is `@1`.
The final settle fills the mutation with that action. The web drive's `logs`
records `in-app-browser: dismissed https://example.com` (or `opened`).
In `app.test.contract`, answer the held ticket by capability name:

```contract-test
test "checkout dismisses the browser"
  tap "checkout"
  tap "@browser" dismissed
  clock data
  expect text "result" == "dismissed"
```

A drive confirms the open request and substituted reply; it cannot see Safari's
sheet. To inspect the real sheet automatically on a simulator, use XCUITest
against a normal app launch without the agent.

On iOS 27 in English the dismiss control's accessibility label is `Close`: the
package leaves Safari's default
[dismiss style](https://developer.apple.com/documentation/safariservices/sfsafariviewcontroller/dismissbuttonstyle-swift.property)
unless a call sets one. If its accessibility tap leaves the sheet up, tap a coordinate at the centre of
that button's frame, then assert the sheet is gone and the prior app screen is
back. See the package's `test/checklist.md` for platform checks.
