浏览器缩放检测的js代码
2014-09-28 23:19
543 查看
测试代码
效果:
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.5
window.outerWidth / window.innerWidth : 1.0084033613445377
document.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
您可能感兴趣的文章:
相关文章推荐
- js检测浏览器版本代码,兼容ie11
- 浏览器检测JS代码(兼容目前各大主流浏览器)
- javascript检测浏览器的缩放状态实现代码
- 检测各种浏览器、系统的JS代码
- js检测浏览器代码
- javascript检测浏览器的缩放状态实现代码 是指浏览器网页内容的百分比缩放(按Ctrl和+号键或者-号键的缩放)
- js判断手机网站,手机浏览器检测,并跳转到手机网站代码
- js浏览器缩放比例检测
- js原生代码编写一个鼠标在页面移动坐标的检测功能,兼容各大浏览器
- js判断手机网站,手机浏览器检测,并跳转到手机网站代码
- 检测浏览器的版本的js代码
- javascript检测浏览器的缩放状态实现代码
- 浏览器检测JS代码(兼容目前各大主流浏览器)
- javascript检测浏览器的缩放状态实现代码
- 使用js检测浏览器的实现代码
- 浏览器版本检测JS代码
- 使用js检测浏览器的实现代码
- js获取鼠标位置杂谈附多浏览器兼容代码
- 一段可以判断浏览器的ajax的js代码
- javascript 检测浏览器类型、操作系统平台的代码