當前位置:編程學習大全網 - 網站源碼 - document.documentElement.outerHTML,這個方法是怎麽用的啊?

document.documentElement.outerHTML,這個方法是怎麽用的啊?

如果妳是iOS開發,使用的是WKWebView,妳可以使用以下方法獲取html的標簽對內容。

NSString* doc = @"document.documentElement.outerHTML";

[self.webView

evaluateJavaScript:doc

completionHandler:^(id _Nullable htmlStr, NSError* _Nullable error) {

if (error) {

NSLog(@"JSError:%@", error);

}

NSLog(@"html:%@", htmlStr);

}];

  • 上一篇:星球重啟沒有火元素怎麽辦
  • 下一篇:Linux中的零拷貝技術,sendfile,splice和tee之間的區別是什麽
  • copyright 2024編程學習大全網