In the main HTML file, the following lines for viewport are specified:
<meta content="width=device-width, initial-scale=1.0, maximum-scale=1.0, minimum-scale=1.0, user-scalable=0" name="viewport">
Experiment:
I have tried to update the width
from device-width
to 640
and added the following codes to a JavaScript file on initialization.
alert("Viewport - Width: " + $(window).width() + "Height: " + $(window).height());
alert("Device - Width: " + window.screen.width + "Height: " + window.screen.height);
Result:
Samsung Galaxy S3 (Resolution: 720 x 1280):
(a) width=device-width & width=640:
Viewport - Width: 360, Height: 615
Device - Width: 720, Height: 1280iOS Simulator iPhone (Retina 3.5 - inch):
(a) width=device-width:
Viewport - Width: 320 Height: 460
Device - Width: 320, Height: 480
(b) width=640:
Viewport - Width: 640 Height: 960
Device - Width: 320, Height: 480
Question 1: It seems to me that Android WebView is not based on the viewport setting. In the testing result, the viewport's width is 360 instead of 720. Where is the value "360" comes from?
Question 2: The resolution in iPhone retina 3.5 is 640 x 960. Is it because retina display so it returns 320 and 480 for width and height respectively?