Firefox Tomorrow

web api instance property

ScreenDetails: currentScreen property

View on MDN ↗

Limited availabilitySecure context

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

// 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

SpecificationsStandards references are available on the canonical MDN page.

Browser compatibility

Browser compatibilityCompatibility data is available on the canonical MDN page.

See also