效果:
chrome
代碼如下:
window.devicePixelRatio : 2 (準(zhǔn)確)
screen.deviceXDPI / screen.logicalXDPI : NaN
window.outerWidth / window.innerWidth : 2
document.documentElement.offsetHeight / window.innerHeight : 0.020618556701030927 (有相關(guān)性)
window.top.outerWidth / window.top.innerWidth : 2
ff
代碼如下:
window.devicePixelRatio : 1.5 (準(zhǔn)確)
screen.deviceXDPI / screen.logicalXDPI : NaN
window.outerWidth / window.innerWidth : 1.0114583333333333
document.documentElement.offsetHeight / window.innerHeight : 0.023391812865497075 (有相關(guān)性)
window.top.outerWidth / window.top.innerWidth : 1.0114583333333333
ie 8
代碼如下:
window.devicePixelRatio : undefined
screen.deviceXDPI / screen.logicalXDPI : 1.5416666666666667 (大致準(zhǔn)確)
window.outerWidth / window.innerWidth : NaN
document.documentElement.offsetHeight / window.innerHeight : NaN
window.top.outerWidth / window.top.innerWidth : NaN
ie11
代碼如下:
window.devicePixelRatio : 1.5 (準(zhǔn)確)
screen.deviceXDPI / screen.logicalXDPI : 1.5
window.outerWidth / window.innerWidth : 1.0084033613445377
document.documentElement.offsetHeight / window.innerHeight : 0.02203856749311295 (有相關(guān)性)
window.top.outerWidth / window.top.innerWidth : 1.0084033613445377
ie10
代碼如下:
window.devicePixelRatio : undefined
screen.deviceXDPI / screen.logicalXDPI : 1.5 (準(zhǔn)確)
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 (準(zhǔn)確)
window.outerWidth / window.innerWidth : 1.0084033613445377
document.documentElement.offsetHeight / window.innerHeight : 1
window.top.outerWidth / window.top.innerWidth : 1.0084033613445377
360 6.3(完全沒(méi)反應(yīng))
代碼如下:
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(準(zhǔn)確)
搜狗高速瀏覽器 (完全沒(méi)反應(yīng))
代碼如下:
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 (大致準(zhǔn)確)
document.documentElement.offsetHeight / window.innerHeight : 0.022988505747126436
window.top.outerWidth / window.top.innerWidth : 2.0710059171597632
更多信息請(qǐng)查看IT技術(shù)專欄
2025國(guó)考·省考課程試聽(tīng)報(bào)名