源码网商城,靠谱的源码在线交易网站 我的订单 购物车 帮助

源码网商城

浏览器缩放检测的js代码

  • 时间:2021-07-14 14:23 编辑: 来源: 阅读:
  • 扫一扫,手机访问
摘要:浏览器缩放检测的js代码
测试代码 [url=http://jsbin.com/dipijeqi/11]http://jsbin.com/dipijeqi/11[/url] 效果: chrome
[u]复制代码[/u] 代码如下:
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
[u]复制代码[/u] 代码如下:
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
[u]复制代码[/u] 代码如下:
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
[u]复制代码[/u] 代码如下:
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
[u]复制代码[/u] 代码如下:
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
[u]复制代码[/u] 代码如下:
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(完全没反应)
[u]复制代码[/u] 代码如下:
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极速浏览器
[u]复制代码[/u] 代码如下:
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(准确)
搜狗高速浏览器 (完全没反应)
[u]复制代码[/u] 代码如下:
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
淘宝浏览器
[u]复制代码[/u] 代码如下:
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
  • 全部评论(0)
联系客服
客服电话:
400-000-3129
微信版

扫一扫进微信版
返回顶部