window.devicePixelRatio = window.devicePixelRatio || window.screen.deviceXDPI / window.screen.logicalXDPI;
window.devicePixelRatio = Math.round(window.devicePixelRatio * 100) / 100;
if(navigator.userAgent.indexOf("MSIE") > 0) {
//IE 浏览器
document.write(Math.round(window.screen.width * window.devicePixelRatio) + "×" + Math.round(window.screen.height * window.devicePixelRatio));
}
else {
//非 IE 浏览器
document.write(parseInt(window.screen.width * window.devicePixelRatio) + "×" + parseInt(window.screen.height * window.devicePixelRatio));
}
分类: 前端开发
0 条评论