此页面由社区从英文翻译而来。了解更多并加入 MDN Web Docs 社区。

View in English Always switch to English

MediaDeviceInfo:deviceId 属性

Baseline Widely available

This feature is well established and works across many devices and browser versions. It’s been available across browsers since 2017年9月.

安全上下文: 此特性仅在一些支持的浏览器安全上下文(HTTPS)中可用。

MediaDeviceInfo 接口的 deviceId 只读属性返回包含所表示的设备的标识符的字符串,并且该值在不同的会话中将保持不变。

其他应用程序无法猜测该标识符,并且它对于调用的应用程序是唯一的。当用户清除 cookie 时会同时重置该标识符。在隐私浏览模式,则会使用一个不同的标识符(此时标识符不会在不同的会话中保持不变)。