简体   繁体   中英

How do I get the html document size using javascript in a UIWebView

I'm trying to determine the size of the html document in a UIWebView. window.innerWidth works on iOS4 but it doesn't work on iOS3 (wrong value). document.documentElement.clientWidth isn't reliable on either. Is there another way to use javascript to determine the width of the document (which should make the size of the webview in this case).

那可以工作:

CGFloat currentWindowWidth = [[webView stringByEvaluatingJavaScriptFromString:@"window.innerWidth"] floatValue];

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

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