ScreenDetails: currentScreen 屬性
ScreenDetails 介面的只讀屬性 currentScreen 包含一個 ScreenDetailed 物件,該物件表示當前瀏覽器視窗顯示所在螢幕的詳細資訊。
值
一個 ScreenDetailed 物件。
示例
js
// Utility function for opening new windows
function openWindow(left, top, width, height, url) {
const windowFeatures = `left=${left},top=${top},width=${width},height=${height}`;
return window.open(url, "_blank", windowFeatures);
}
// Open a new window that fills the available area of the current screen.
const currentScreen = (await window.getScreenDetails()).currentScreen;
console.log(`Opening a window to fill screen ${currentScreen.label}`);
const windowRef = openWindow(
currentScreen.availLeft,
currentScreen.availTop,
currentScreen.availWidth,
currentScreen.availHeight,
url,
);
規範
| 規範 |
|---|
| 視窗管理 # ref-for-dom-screendetails-currentscreen |
瀏覽器相容性
載入中…