简体   繁体   中英

Javascript iPad, iPhone and Android - How to get page full width and height?

I am wondering how to get the page width/height and not the viewport's width and height. I tried innerWidth/Height and outerWidth/height.

In order to get the complete width/height of the screen so i need to + the inner with the outer? Or os there some other way to get the complete page width/height for the 3 devices i mentioned in my title.

if you're using iphone or ipad's UIWebView, you can use this Javascript Code;

NSLog(@"%@",[webview stringByEvaluatingJavaScriptFromString:@"document.body.scrollWidth;"]);
NSLog(@"%@",[webview stringByEvaluatingJavaScriptFromString:@"document.body.scrollHeight;"]);

your scroll size is your full page size.

i dont have any idea about android or etc.

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