I am making a responsive site based on percentages. I have included the viewport tag as follows
<meta name="viewport" content="width=device-width, initial-scale=1.0, maximum-scale=1.0, minimum-scale=1.0"/>
and the html and body tags are as follows:
html {
width:100%;
height:100%;
margin:0;
}
body {
width:100%;
height:100%;
margin:0;
}
and other elements take their sizes from there. Everything looks fine in Chrome emulator tools and I based my CSS on how things looked there (foolish?), but when I test on actual devices I my design breaks because the mobile browser ui elements (url bar sliding in and out etc) cause me problems. For example, on Android devices, on scroll up and down, the window size constantly changes and on ios it seems to stay static at the original height even after the url bar slides out. This might help readers understand better.
The following snippet
alert( 'Your screen resolution is ' + screen.width + 'x' + screen.height );
var h = $( window ).height();
alert(h);
$(window).resize(function() {
var newh = $( window ).height();
alert(newh);
});
tested on a iPhone 4 (ios7), an Asus Nexus 7 (Lollipop), and a Samsung Galaxy S-Plus (Android 2.3) gives me the following results:
iPhone: 320x480, 372 and no change then on resize.
Nexus: 601x962, 785, 881. (96px differential)
Galaxy-S Plus: 320x452 (measures screen height less ui initially?), 452, 508.
After getting tumbleweed (maybe unclear?) on this here
Is there a way to prevent viewport resizing due to ui elements like url bar? I am still stumped.