将html附加到webview内容

问题描述:

目前正在将网址(如Google.com)加载到我的网络视图中

currently loading a URL like Google.com into my web view like so

[webView setMainFrameURL:@"http://google.com"];

如何将html附加到< h1>页< / h1>
感谢

How can I append html to that like "<h1>End of page</h1>"? Thanks

您需要在页面加载到DOM文档对象模型之后操作DOM code> WebView 。您可以使用 WebFrameLoadDelegate 方法来确定网页何时成功加载。

You would need to manipulate the DOM (Document Object Model) after the page has loaded in the WebView. You can use the WebFrameLoadDelegate methods to determine when the page has loaded successfully.

要操作DOM,您可以通过各种DOM操作类使用Objective-C ,或者您可以使用JavaScript。

To manipulate the DOM, you can use Objective-C via the various DOM manipulation classes or you can use JavaScript.