NavigatorUAData:mobile 属性

Limited availability

This feature is not Baseline because it does not work in some of the most widely-used browsers.

实验性: 这是一项实验性技术
在将其用于生产之前,请仔细检查浏览器兼容性表格

备注: 此特性在 Web Worker 中可用。

NavigatorUAData 接口的 mobile 只读属性返回一个值,指示设备是否是移动设备。

一个布尔值,如果设备是移动设备,则为 true

示例

以下示例将 mobile 的值打印到控制台。

js
console.log(navigator.userAgentData.mobile);

规范

Specification
User-Agent Client Hints
# dom-navigatoruadata-mobile

浏览器兼容性

Report problems with this compatibility data on GitHub
desktopmobile
Chrome
Edge
Firefox
Opera
Safari
Chrome Android
Firefox for Android
Opera Android
Safari on iOS
Samsung Internet
WebView Android
WebView on iOS
mobile
Experimental

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.

参见