简体   繁体   English

我如何获取当前在Web视图上显示的html的内容?

[英]How do i get the contents of html that currently displaying on web view?

How do i get the current displaying contents of html in web view(epub). 如何获取Web View(epub)中html的当前显示内容。 Is there any way to get the current displying contents (view port contents) instead displying all contents using following document.getElementById().innerHTML() . 有什么方法可以使用以下document.getElementById().innerHTML()获取当前显示内容(查看端口内容),而不是显示所有内容。

Is there any way to get webview displaying contents froma big html file. 有什么方法可以让Webview显示大HTML文件中的内容。

If you want to extract the contents of a UIWebView you can use -stringByEvaluatingJavaScriptFromString . 如果要提取UIWebView的内容,可以使用-stringByEvaluatingJavaScriptFromString

Example: 例:

NSString *html = [webView stringByEvaluatingJavaScriptFromString: @"document.body.innerHTML"];

Hope it helps you. 希望对您有帮助。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM