<script>
function Calculatescale () {
var phonewidth = parseint (window.screen.width);
var Phonescale = phonewidth/1280;//divided by the value of the phone's physical resolution
var ua = navigator.useragent;
var viewportmetacontent = "";
if (/android (\d+\.\d+)/.test (UA)) {
var version = parsefloat (regexp.$1);
if (Version > 2.3) {//Andriod 2.3 or more
Viewportmetacontent= ' width=device-width,initial-scale= ' + Phonescale + ', minimum-scale= ' + PhoneScale + ', User-scalable=yes ';
} else {
Viewportmetacontent= ' Width=device-width,user-scalable=yes ';
}
Other systems
} else {
Viewportmetacontent = ' width=device-width, initial-scale= ' + Phonescale + ', minimum-scale= ' + PhoneScale + ', user-scalabl E=yes ';
}
return viewportmetacontent;
}
document.write (' <meta name= ' viewport "content=" ' +calculatescale () + ' > ');
</script>
Window.addeventlistener (' Orientationchange ', function (event) {
var Viewportmeta = document.queryselector (' meta[name= "viewport"] ");
if (Viewportmeta) {
Viewportmeta.content = Calculatescale ();
}
});
Web sites are scaled under different devices