ScreenDetails: currentScreen property
Limited availability
This feature is not Baseline because it does not work in some of the most widely-used browsers.
Experimental: This is an experimental technology
Check the Browser compatibility table carefully before using this in production.
Secure context: This feature is available only in secure contexts (HTTPS), in some or all supporting browsers.
The currentScreen
read-only property of the
ScreenDetails
interface contains a single ScreenDetailed
object representing detailed information about the screen that the current browser window is displayed in.
Value
A ScreenDetailed
object.
Examples
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,
);
Specifications
Specification |
---|
Window Management # ref-for-dom-screendetails-currentscreen |
Browser compatibility
Report problems with this compatibility data on GitHubdesktop | mobile | |||||||||||
---|---|---|---|---|---|---|---|---|---|---|---|---|
currentScreen |
Legend
Tip: you can click/tap on a cell for more information.
- Full support
- Full support
- No support
- No support
- Experimental. Expect behavior to change in the future.
The compatibility table on this page is generated from structured data. If you'd like to contribute to the data, please check out https://github.com/mdn/browser-compat-data and send us a pull request.