Click or drag to resize

EmulationSetDeviceMetricsOverrideAsync Method

Version 85.3.121
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: 85.3.121.0 (85.3.121.0)
Syntax
public Task<DevToolsMethodResponse> SetDeviceMetricsOverrideAsync(
	int width,
	int height,
	long deviceScaleFactor,
	bool mobile,
	Nullable<long> scale = null,
	Nullable<int> screenWidth = null,
	Nullable<int> screenHeight = null,
	Nullable<int> positionX = null,
	Nullable<int> positionY = null,
	Nullable<bool> dontSetVisibleSize = null,
	ScreenOrientation screenOrientation = null,
	Viewport viewport = 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: SystemInt64
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: SystemNullableInt64
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.

Return Value

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