<!--
{
  "availability" : [
    "macOS: 10.15.0 -"
  ],
  "documentType" : "symbol",
  "framework" : "SafariServices",
  "identifier" : "/documentation/SafariServices/SFSafariExtensionHandling/page(_:willNavigateTo:)",
  "metadataVersion" : "0.1.0",
  "role" : "Instance Method",
  "symbol" : {
    "kind" : "Instance Method",
    "modules" : [
      "Safari Services"
    ],
    "preciseIdentifier" : "c:objc(pl)SFSafariExtensionHandling(im)page:willNavigateToURL:"
  },
  "title" : "page(_:willNavigateTo:)"
}
-->

# page(_:willNavigateTo:)

A method the system calls when a webpage is about to navigate to a new URL.

```
optional func page(_ page: SFSafariPage, willNavigateTo url: URL?)
```

## Parameters

`page`

The webpage from which the user or script initiated the navigation.

`url`

A URL for the destination webpage.

## Discussion

The `url` parameter is `nil` if the extension does not have permission to access the destination webpage.

---

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)