<!--
{
  "availability" : [
    "macOS: 10.3.0 - 10.14.0"
  ],
  "documentType" : "symbol",
  "framework" : "WebKit",
  "identifier" : "/documentation/WebKit/WebFrame/loadAlternateHTMLString(_:baseURL:forUnreachableURL:)",
  "metadataVersion" : "0.1.0",
  "role" : "Instance Method",
  "symbol" : {
    "kind" : "Instance Method",
    "modules" : [
      "WebKit"
    ],
    "preciseIdentifier" : "c:objc(cs)WebFrame(im)loadAlternateHTMLString:baseURL:forUnreachableURL:"
  },
  "title" : "loadAlternateHTMLString(_:baseURL:forUnreachableURL:)"
}
-->

# loadAlternateHTMLString(_:baseURL:forUnreachableURL:)

Loads alternate content for a frame whose URL is unreachable.

```
func loadAlternateHTMLString(_ string: String!, baseURL: URL!, forUnreachableURL unreachableURL: URL!)
```

## Parameters

`string`

The string to use as the main page for the document.

`baseURL`

A file that is used to resolve relative URLs within the document.

`unreachableURL`

The URL for the alternate page content.

## Discussion

Use this method to display page-level loading errors in a web view. Typically, a `WebFrameLoadDelegate` or `WebPolicyDelegate` object invokes this method from these methods: `webView:didFailProvisionalLoadWithError:forFrame:` (`WebFrameLoadDelegate`), webView:decidePolicyForMIMEType:request:frame:decisionListener: (`WebPolicyDelegate`), or [`webView(_:unableToImplementPolicyWithError:frame:)`](/documentation/WebKit/WebPolicyDelegate/webView(_:unableToImplementPolicyWithError:frame:)) (`WebPolicyDelegate`). If invoked from one of these methods, the back-forward list is maintained.

---

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)