首页 / JAVASCRIPT / 浏览器缩放检测的js代码
浏览器缩放检测的js代码
内容导读
互联网集市收集整理的这篇技术教程文章主要介绍了浏览器缩放检测的js代码,小编现在分享给大家,供广大互联网技能从业者学习和参考。文章包含2986字,纯文字阅读大概需要5分钟。
内容图文
![浏览器缩放检测的js代码](/upload/InfoBanner/zyjiaocheng/323/e10589e5ef234f4cbfe566c609ebf4b8.jpg)
测试代码
http://jsbin.com/dipijeqi/11
效果:
chrome:
window.devicePixelRatio : 2 (准确) screen.deviceXDPI / screen.logicalXDPI : NaN window.outerWidth / window.innerWidth : 2 document.documentElement.offsetHeight / window.innerHeight : 0.020618556701030927 (有相关性) window.top.outerWidth / window.top.innerWidth : 2
ff:
window.devicePixelRatio : 1.5 (准确) screen.deviceXDPI / screen.logicalXDPI : NaN window.outerWidth / window.innerWidth : 1.0114583333333333 document.documentElement.offsetHeight / window.innerHeight : 0.023391812865497075 (有相关性) window.top.outerWidth / window.top.innerWidth : 1.0114583333333333
ie 8:
window.devicePixelRatio : undefined screen.deviceXDPI / screen.logicalXDPI : 1.5416666666666667 (大致准确) window.outerWidth / window.innerWidth : NaN document.documentElement.offsetHeight / window.innerHeight : NaN window.top.outerWidth / window.top.innerWidth : NaN
ie11:
window.devicePixelRatio : 1.5 (准确) screen.deviceXDPI / screen.logicalXDPI : 1.5window.outerWidth / window.innerWidth : 1.0084033613445377document.documentElement.offsetHeight / window.innerHeight : 0.02203856749311295 (有相关性)window.top.outerWidth / window.top.innerWidth : 1.0084033613445377
ie10:
window.devicePixelRatio : undefined screen.deviceXDPI / screen.logicalXDPI : 1.5 (准确) window.outerWidth / window.innerWidth : 1.0084033613445377 document.documentElement.offsetHeight / window.innerHeight : 1 window.top.outerWidth / window.top.innerWidth : 1.0084033613445377
ie9:
window.devicePixelRatio : undefined screen.deviceXDPI / screen.logicalXDPI : 1.5 (准确) window.outerWidth / window.innerWidth : 1.0084033613445377 document.documentElement.offsetHeight / window.innerHeight : 1 window.top.outerWidth / window.top.innerWidth : 1.0084033613445377
360 6.3(完全没反应):
window.devicePixelRatio : undefined screen.deviceXDPI / screen.logicalXDPI : 1 window.outerWidth / window.innerWidth : NaN document.documentElement.offsetHeight / window.innerHeight : NaN window.top.outerWidth / window.top.innerWidth : NaN
360极速浏览器:
window.devicePixelRatio : 1 screen.deviceXDPI / screen.logicalXDPI : NaN window.outerWidth / window.innerWidth : 1.5 document.documentElement.offsetHeight / window.innerHeight : 0.015267175572519083 window.top.outerWidth / window.top.innerWidth : 1.5(准确)
搜狗高速浏览器 (完全没反应):
window.devicePixelRatio : undefined screen.deviceXDPI / screen.logicalXDPI : 1 window.outerWidth / window.innerWidth : NaN document.documentElement.offsetHeight / window.innerHeight : NaN window.top.outerWidth / window.top.innerWidth : NaN
淘宝浏览器:
window.devicePixelRatio : 1 screen.deviceXDPI / screen.logicalXDPI : NaN window.outerWidth / window.innerWidth : 2.0710059171597632 (大致准确) document.documentElement.offsetHeight / window.innerHeight : 0.022988505747126436 window.top.outerWidth / window.top.innerWidth : 2.0710059171597632
以上就是本章的全部内容,更多相关教程请访问JavaScript视频教程!
内容总结
以上是互联网集市为您收集整理的浏览器缩放检测的js代码全部内容,希望文章能够帮你解决浏览器缩放检测的js代码所遇到的程序开发问题。 如果觉得互联网集市技术教程内容还不错,欢迎将互联网集市网站推荐给程序员好友。
内容备注
版权声明:本文内容由互联网用户自发贡献,该文观点与技术仅代表作者本人。本站仅提供信息存储空间服务,不拥有所有权,不承担相关法律责任。如发现本站有涉嫌侵权/违法违规的内容, 请发送邮件至 gblab@vip.qq.com 举报,一经查实,本站将立刻删除。
内容手机端
扫描二维码推送至手机访问。