Click or drag to resize

EmulationClientSetDeviceMetricsOverrideAsync Method

Version 107.1.120
Overrides the values of device screen dimensions (window.screen.width, window.screen.height, window.innerWidth, window.innerHeight, and "device-width"/"device-height"-related CSS media query results).

Namespace:  CefSharp.DevTools.Emulation
Assembly:  CefSharp (in CefSharp.dll) Version: 107.1.120.0 (107.1.120.0)
Syntax
public Task<DevToolsMethodResponse> SetDeviceMetricsOverrideAsync(
	int width,
	int height,
	double deviceScaleFactor,
	bool mobile,
	double? scale = null,
	int? screenWidth = null,
	int? screenHeight = null,
	int? positionX = null,
	int? positionY = null,
	bool? dontSetVisibleSize = null,
	ScreenOrientation screenOrientation = null,
	Viewport viewport = null,
	DisplayFeature displayFeature = null
)

Parameters

width
Type: SystemInt32
Overriding width value in pixels (minimum 0, maximum 10000000). 0 disables the override.
height
Type: SystemInt32
Overriding height value in pixels (minimum 0, maximum 10000000). 0 disables the override.
deviceScaleFactor
Type: SystemDouble
Overriding device scale factor value. 0 disables the override.
mobile
Type: SystemBoolean
Whether to emulate mobile device. This includes viewport meta tag, overlay scrollbars, textautosizing and more.
scale (Optional)
Type: SystemNullableDouble
Scale to apply to resulting view image.
screenWidth (Optional)
Type: SystemNullableInt32
Overriding screen width value in pixels (minimum 0, maximum 10000000).
screenHeight (Optional)
Type: SystemNullableInt32
Overriding screen height value in pixels (minimum 0, maximum 10000000).
positionX (Optional)
Type: SystemNullableInt32
Overriding view X position on screen in pixels (minimum 0, maximum 10000000).
positionY (Optional)
Type: SystemNullableInt32
Overriding view Y position on screen in pixels (minimum 0, maximum 10000000).
dontSetVisibleSize (Optional)
Type: SystemNullableBoolean
Do not set visible view size, rely upon explicit setVisibleSize call.
screenOrientation (Optional)
Type: CefSharp.DevTools.EmulationScreenOrientation
Screen orientation override.
viewport (Optional)
Type: CefSharp.DevTools.PageViewport
If set, the visible area of the page will be overridden to this viewport. This viewportchange is not observed by the page, e.g. viewport-relative elements do not change positions.
displayFeature (Optional)
Type: CefSharp.DevTools.EmulationDisplayFeature
If set, the display feature of a multi-segment screen. If not set, multi-segment supportis turned-off.

Return Value

Type: TaskDevToolsMethodResponse
returns System.Threading.Tasks.Task<DevToolsMethodResponse>
See Also