css - mobile version doesn't appear on iphone -
i'm developing website has full version , mobile version.
and i'm using code set viewport meta tag:
<meta id="viewport" name="viewport" content="width=1100, maximum-scale=1.0" /> <script> devicewidth = window.innerwidth; var viewport = document.getelementbyid('viewport'); if(devicewidth <= 480) viewport.setattribute('content', 'width=device-width, initial-scale=1.0,maximum-scale=1.0'); </script>
so default meta set content-width = 1100
, if device-width smaller 480px set 'width=device-width
.
it works on android phones, doesn't work on iphone.
what problem , how can fix ?
to match flexible layout width device width , can use one:
<meta name="viewport" content="width=device-width, initial-scale=1">
this works android, iphone , browsers. no need change content meta tag detect device/browser width.
learn more meta tags here.
Comments
Post a Comment