![](/img/trans.png)
[英]Is there a way to get the real viewport size in hardware-pixels without viewport meta tag?
[英]How to get the viewport size in real device pixels?
有screen.width
和screen.height
屬性,它們以實際設備像素為單位包含屏幕的寬度和高度。 但是,它們不能說明屏幕上的部分內容是否來自網頁以外的內容,例如電話的狀態欄和瀏覽器的地址欄/帶有按鈕以擴展選項卡列表的選項卡名稱。 有沒有辦法找出瀏覽器實際分配給視口的屏幕空間?
window.innerWidth
將為您提供視口的寬度。
window.innerHeight
將為您提供視口的高度。
聲明:本站的技術帖子網頁,遵循CC BY-SA 4.0協議,如果您需要轉載,請注明本站網址或者原文地址。任何問題請咨詢:yoyou2525@163.com.