test测试test测试test测试test测试浏览器
获取当前页面浏览器的缩放大小: // 判断pc浏览器是否缩放,若返回100则为默认无缩放,若是大于100则是放大,不然缩小 function detectZoom (){ var ratio = 0, screen = window.screen, ua = navigator.userAgent.toLowerCase(); if (window.devicePixelRatio !== undefined) { ratio = window.devicePixelRatio; } else if (~ua.indexOf('msie')) { if (screen.deviceXDPI && screen.logicalXDPI) { ratio = screen.deviceXDPI / screen.logicalXDPI; } } else if (window.outerWidth !== undefined && window.innerWidth !== undefined) { ratio = window.outerWidth / window.innerWidth; } if (ratio){ ratio = Math.round(ratio * 100); } return ratio; }; //具体实现demo: 浏览器网页内容的百分比缩放(按Ctrl和+号键或者-号键的缩放) 知乎客户端