A summary of the width and height in iOS webview

Source: Internet
Author: User

Test A

Items Tested:

<meta charset="UTF-8" >

<meta name= "Viewport" content= "initial-scale=0.5 user-scalable=no" />

<meta http-equiv= "Content-type" Content= "text/html; charset=utf-8"/>

<title>smadunit</title>

<body style= "margin:0px auto; padding:0; overflow:hidden; background-color:transparent;" ><p>

<a href="http://appsrv1.madserving.com/cli2/ Lgkrp9de65881hl5rl30066fjiv46q6881bqupb25bee2ec. MzY5MDQxMg.c46ab76d2859.ODY2Mjc4MDE. ody2mjc4mdeznjkwndey...-1-1hlx5d/napi1.0.0000/90042385">src="/http Ws-cdn.tangmobile.com/2009/smartmad2/20/52/25bee2ec.jpg" /></a></p>

</body>

<script Type= "Text/javascript">

function Loadimagefinish () {

Console.log (' document.body.clientWidth ' + document.body.clientWidth);

Console.log (' document.body.clientHeight ' + document.body.clientHeight);

Console.log (' window.screen.height ' + window.screen.height);

Console.log (' window.screen.width ' + window.screen.width);

Console.log (' window.screen.availHeight ' + window.screen.availHeight);

Console.log (' window.screen.availWidth ' + window.screen.availWidth);

Console.log (' window.innerwidth ' + window.innerwidth);

Console.log (' window.innerheight ' + window.innerheight);

Console.log (' window.outerwidth ' + window.outerwidth);

Console.log (' window.outerheight ' + window.outerheight);

Console.log (' window.screenleft ' + window.screenleft);

Console.log (' window.screentop ' + window.screentop);

Console.log (' window.screeny ' + window.screeny);

Console.log (' Window.screenx ' + Window.screenx);

}

var = window.setinterval (Loadimagefinish, Timerid);

</script>

WebView set to 300*280

Test equipment IPad

This is debug using Safair:

Test Two

Items Tested:

<meta charset="UTF-8" >

<meta name= "Viewport" content= "Width=device-width, user-scalable=no">

<meta http-equiv= "Content-type" Content= "text/html; charset=utf-8"/>

<title>smadunit</title>

<body style= "margin:0px auto; padding:0; overflow:hidden; background-color:transparent;" ><p>

<a href="http://appsrv1.madserving.com/cli2/ Lgkrp9de65881hl5rl30066fjiv46q6881bqupb25bee2ec. MzY5MDQxMg.c46ab76d2859.ODY2Mjc4MDE. ody2mjc4mdeznjkwndey...-1-1hlx5d/napi1.0.0000/90042385">src="/http Ws-cdn.tangmobile.com/2009/smartmad2/20/52/25bee2ec.jpg" /></a></p>

</body>

<script Type= "Text/javascript">

function Loadimagefinish () {

Console.log (' document.body.clientWidth ' + document.body.clientWidth);

Console.log (' document.body.clientHeight ' + document.body.clientHeight);

Console.log (' window.screen.height ' + window.screen.height);

Console.log (' window.screen.width ' + window.screen.width);

Console.log (' window.screen.availHeight ' + window.screen.availHeight);

Console.log (' window.screen.availWidth ' + window.screen.availWidth);

Console.log (' window.innerwidth ' + window.innerwidth);

Console.log (' window.innerheight ' + window.innerheight);

Console.log (' window.outerwidth ' + window.outerwidth);

Console.log (' window.outerheight ' + window.outerheight);

Console.log (' window.screenleft ' + window.screenleft);

Console.log (' window.screentop ' + window.screentop);

Console.log (' window.screeny ' + window.screeny);

Console.log (' Window.screenx ' + Window.screenx);

}

var = window.setinterval (Loadimagefinish, Timerid);

</script>

WebView set to 300*280

Test equipment IPad

This is debug using Safair:

Comparison of two item discoveries

Material One

<meta Name= "Viewport" content= "initial-scale=0.5 user-scalable=no" />

Item Two

<meta Name= "Viewport" content= "Width=device-width, user-scalable=no">

Personally think: Because the setting of viewport results in material two document.body.clientWidth return width is the width of the device, document.body.clientHeight height in accordance with the proportion of 300*280 magnification 280* (768/300) =716.8 (approximately equal to 717)

To get the actual width of the webview, consider using Window.innerwidth,window.innnerheight. (Data reality These two returned values do not include the border width)

A summary of the width and height in iOS webview

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.