How to calculate scrollWidth of an HTML page for a fixed height without using a UIWebView

We can use the following to calculate the scrollWidth of an HTML page in a fixed height UIWebView.

[webView stringByEvaluatingJavaScriptFromString:@"document.documentElement.scrollWidth"]

Is it possible to perform this assessment on local HTML pages without loading the request into a UIWebView?

I would like this to happen in a separate thread.

+3
source share
1 answer

(). Html , - . , html/css/javascript (javascript html/css, css html). UIWebView, :

  • , , ( -, ) - . , , UIWebView, , , .
  • -. . , . , , . UIWebView

EDIT:

, UIWebView , ? , , - ?:

 UIWebView *webview = [[UIWebView alloc] initWithFrame:CGRectMake(0,0,320,460)];
 webview.delegate = self;
 [webview loadRequest: [NSURLRequest requestWithURL:[NSURL urlFromString:@"/path/to/file.html"]]];

... ...

 - (void) webViewDidFinishLoad:(UIWebView *)webView 
 {
    // run your code to get scroll width of page
 }
+3

All Articles