Class Screen
- Namespace
- CSharpToJavaScript.APIs.JS
- Assembly
- CSharpToJavaScript.dll
The Screen interface represents a screen, usually the one on which the current window is being rendered, and is obtained using Screen.
[Value("Screen")]
public class Screen
- Inheritance
-
Screen
- Derived
- Inherited Members
Remarks
Note that browsers determine which screen to report as current by detecting which screen has the center of the browser window.
Constructors
Screen()
public Screen()
Properties
AvailHeight
The read-only Screen interface'savailHeight property returns the height, in CSS pixels, of
the space available for Web content on the screen. Since Screen is
exposed on the Window interface's Screen
property, you access availHeight using window.screen.availHeight.
[Value("availHeight")]
public long AvailHeight { get; }
Property Value
- long
A numeric value indicating the number of CSS pixels tall the screen's available space
is. This can be no larger than the value of Height,
and will be less if the device or user agent reserves any
vertical space for itself.For instance, on a Mac whose Dock is located at the bottom of screen (which is the default), the value ofavailHeightis approximately the value ofheight(the total height of the screen in CSS pixels) minus the heights of the Dock and menu bar, as seen in the diagram below. They only take upavailHeightif they are always shown: if the page is fullscreened, or if the dock is configured to automatically hide and show, then they won't be counted inavailHeight.Diagram showing how Screen.availHeight relates to Screen.height and the screen's contents
Remarks
You can similarly use AvailWidth to get the number of pixels
which are horizontally available to the browser for its use.
AvailWidth
The Screen.availWidth property returns the amount of
horizontal space (in CSS pixels) available to the window.
[Value("availWidth")]
public long AvailWidth { get; }
Property Value
- long
A number.
Remarks
ColorDepth
The Screen.colorDepth read-only property returns the
color depth of the screen. Per the CSSOM, some implementations return 24
for compatibility reasons. See the browser compatibility section for those that don't.
[Value("colorDepth")]
public ulong ColorDepth { get; }
Property Value
- ulong
A number.
Remarks
Height
The Screen.height read-only property returns the height
of the screen in CSS pixels.
[Value("height")]
public long Height { get; }
Property Value
- long
A number.
Remarks
IsExtended
NOTE
ExperimentalisExtended read-only property of theScreen interface returns
true if the user's device has multiple screens, and false if not.
[Value("isExtended")]
public bool IsExtended { get; }
Property Value
- bool
A boolean value —
trueif the device has multiple screens, andfalseif not.NOTE
If a Permissions-Policy/window-management Permissions-Policy is set that blocks use the Window Management API,isExtendedwill always returnfalse.
Remarks
This property is typically accessed via window.screen.isExtended, and can be used to test whether multiple screens are available before attempting to create a multi-window, multi-screen layout using the Window Management API.
Onchange
[Value("onchange")]
public EventHandlerNonNull Onchange { get; set; }
Property Value
Orientation
The orientation read-only property of the
Screen interface returns the current orientation of the screen.
[Value("orientation")]
public ScreenOrientation Orientation { get; }
Property Value
- ScreenOrientation
An instance of ScreenOrientation representing the orientation of the
screen.Note that older, prefixed versions returned a string equivalent to
Type.
Remarks
-ScreenOrientation
-Screen.Orientationchange event
-Managing screen orientation
PixelDepth
Returns the bit depth of the screen. Per the CSSOM, some implementations
return 24 for compatibility reasons. See the browser compatibility section for those that don't.
[Value("pixelDepth")]
public ulong PixelDepth { get; }
Property Value
- ulong
A number.
Remarks
Width
The Screen.width read-only property returns the width of
the screen in CSS pixels.
[Value("width")]
public long Width { get; }
Property Value
- long
A number.