Rodomantsev
5/27/2015 - 9:15 AM

min-width=480px

min-width=480px

 (function() {
    if (typeof(window.orientation) !== 'undefined') {
        function getDeviceWidth() {

            var deviceWidth = window.orientation == 0 ? window.screen.width : window.screen.height;
            if (navigator.userAgent.indexOf('Android') >= 0 && window.devicePixelRatio) {
                deviceWidth = Math.min(window.innerWidth, window.outerWidth);
                deviceWidth = deviceWidth / window.devicePixelRatio;
            }

            return deviceWidth;
        }
        var deviceWidth = getDeviceWidth();
        var maxWidth = 480;
        var ua = navigator.userAgent.toLowerCase();
        var isAndroid = ua.indexOf("android") > -1;

        if (deviceWidth <= maxWidth) {

            if ((navigator.userAgent.match(/iPhone/i)) || (navigator.userAgent.match(/iPod/i))) {
                var scale = deviceWidth / maxWidth;
                document.write('<meta name="viewport" content="width=' + 480 + ', initial-scale=' + scale + '">');
            } else {
                document.write('<meta name="viewport" content="width=480"/>');
            }
        } else {
            if (window.orientation == 0 || window.orientation == 180) {
                document.write('<meta name="viewport" content="width=device-width,initial-scale=1">');
                document.write('<meta name="viewport" content="width=device-width,max-scale=1">');
            } else {

                document.write('<meta name="viewport" content="width=device-height,initial-scale=1">');
                document.write('<meta name="viewport" content="width=device-height,max-scale=1">');
            }
        }
    }

})();