> For the complete documentation index, see [llms.txt](https://docs.coda.co/llms.txt). Markdown versions of documentation pages are available by appending `.md` to page URLs; this page is available as [Markdown](https://docs.coda.co/https-coda-payments.gitbook.io-zhong-wen-coda-private-technical-documentation/codapay/webview-zhu-yi-shi-xiang/ios-webview-aboutblank-wen-ti.md).

# iOS WebView (about:blank) 问题

在 iOS WebView 中处理 `about:blank` 页面时，您可以通过实现 `WKUIDelegate` 委托，并将其设置为 `_webview.uiDelegate` 来解决此问题。然后，您需要实现以下方法：

```objective-c
(WKWebView *)webView:(WKWebView *)webView createWebViewWithConfiguration:(WKWebViewConfiguration *)configuration forNavigationAction:(WKNavigationAction *)navigationAction windowFeatures:(WKWindowFeatures *)windowFeatures {
    if (!navigationAction.targetFrame.isMainFrame) {
        [webView loadRequest:navigationAction.request];
    }

    return nil;
}
```

{% hint style="success" %} <mark style="color:green;">**解决方案说明**</mark>

* **实现 `WKUIDelegate`**: `WKUIDelegate` 协议用于处理与 WebView UI 相关的任务。
* **处理新的窗口请求**: 如果请求的目标框架不是主框架（即 `navigationAction.targetFrame.isMainFrame` 为 `NO`），则通过 `loadRequest` 方法将该请求加载到 WebView 中。这可以防止新窗口打开，解决 `about:blank` 的问题。
  {% endhint %}


---

# Agent Instructions
This documentation is published with GitBook. GitBook is the documentation platform designed so that both humans and AI agents can read, navigate, and reason over technical content effectively. Learn more at gitbook.com.

## Querying This Documentation
If you need additional information that is not directly available in this page, you can query the documentation dynamically by asking a question.

Perform an HTTP GET request on the current page URL with the `ask` query parameter, and the optional `goal` query parameter:

```
GET https://docs.coda.co/https-coda-payments.gitbook.io-zhong-wen-coda-private-technical-documentation/codapay/webview-zhu-yi-shi-xiang/ios-webview-aboutblank-wen-ti.md?ask=<question>&goal=<endgoal>
```

`ask` is the immediate question: it should be specific, self-contained, and written in natural language.
`goal` is optional and describes the broader end goal you are ultimately trying to accomplish on behalf of the user. GitBook uses it to tailor the answer towards what is most useful for that goal.

The response will contain a direct answer to the question and relevant excerpts and sources from the documentation.

Use this mechanism when the answer is not explicitly present in the current page, you need clarification or additional context, or you want to retrieve related documentation sections.
