大网数据广告活动
Web 标准与前端开发

WorkerNavigator

· 52CE 我爱测

The **`WorkerNavigator`** interface represents a subset of the Navigator interface allowed to be accessed from a Worker. Such an object is initialized for each worker and is available via the WorkerGlobalScope.navigator property.

Web Workers APIworker

The WorkerNavigator interface represents a subset of the Navigator interface allowed to be accessed from a Worker. Such an object is initialized for each worker and is available via the WorkerGlobalScope.navigator property.

Instance properties

The WorkerNavigator interface doesn't inherit any property.

  • WorkerNavigator.appCodeName
    • : Always returns 'Mozilla', in any browser. This property is kept only for compatibility purposes.
  • WorkerNavigator.appName
    • : Returns the official name of the browser. Do not rely on this property to return the correct value.
  • WorkerNavigator.appVersion
    • : Returns the version of the browser as a string. Do not rely on this property to return the correct value.
  • WorkerNavigator.connection
    • : Provides a NetworkInformation object containing information about the network connection of a device.
  • WorkerNavigator.deviceMemory
    • : Returns the amount of device memory in gigabytes. This value is an approximation given by rounding to the nearest power of 2 and dividing that number by 1024.
  • WorkerNavigator.globalPrivacyControl
    • : Returns a boolean indicating a user's consent to their information being shared or sold.
  • WorkerNavigator.gpu
    • : Returns the GPU object for the current worker context. The entry point for the WebGPU_API.
  • WorkerNavigator.hardwareConcurrency
    • : Returns the number of logical processor cores available.
  • WorkerNavigator.hid
    • : Returns an HID object providing methods for connecting to HID devices already granted permission by the user and listing attached HID devices, and event handlers for responding to HID devices connecting and disconnecting.
  • WorkerNavigator.language
    • : Returns a string representing the preferred language of the user, usually the language of the browser UI. The null value is returned when this is unknown.
  • WorkerNavigator.languages
    • : Returns an array of strings representing the languages known to the user, by order of preference.
  • WorkerNavigator.locks
    • : Returns a LockManager object which provides methods for requesting a new Lock object and querying for an existing Lock object.
  • WorkerNavigator.mediaCapabilities
    • : Returns a MediaCapabilities object that can expose information about the decoding and encoding capabilities for a given format and output capabilities.
  • WorkerNavigator.onLine
    • : Returns a boolean value indicating whether the browser is online.
  • WorkerNavigator.permissions
    • : Returns a Permissions object that can be used to query and update permission status of APIs covered by the Permissions API.
  • WorkerNavigator.platform
    • : Returns a string representing the platform of the browser. Do not rely on this property to return the correct value.
  • WorkerNavigator.product
    • : Always returns 'Gecko', on any browser. This property is kept only for compatibility purposes.
  • WorkerNavigator.serial
    • : Returns a Serial object, which represents the entry point into the Web Serial API, to enable the control of serial ports.
  • WorkerNavigator.serviceWorker
    • : Returns a ServiceWorkerContainer object, which provides access to registration, removal, upgrade, and communication with the ServiceWorker objects for the associated document.
  • WorkerNavigator.storage
    • : Returns a StorageManager interface for managing persistence permissions and estimating available storage.
  • WorkerNavigator.usb
    • : Returns a USB object for the current document, providing access to WebUSB API functionality.
  • WorkerNavigator.userAgent
    • : Returns the user agent string for the current browser.
  • WorkerNavigator.userAgentData
    • : Returns a NavigatorUAData object, which gives access to information about the browser and operating system of the user.

Instance methods

The WorkerNavigator interface doesn't inherit any method.

  • WorkerNavigator.clearAppBadge()
    • : Clears a badge on the current app's icon and returns a Promise that resolves with undefined.
  • WorkerNavigator.setAppBadge()
    • : Sets a badge on the icon associated with this app and returns a Promise that resolves with undefined.

Specifications

Browser compatibility

See also

  • Other Worker-related interfaces: Worker, WorkerLocation, and WorkerGlobalScope
  • Using web workers

来源:MDN Web Docs / Mozilla 贡献者 · 作者与贡献记录 · CC BY-SA 2.5。离线整理了版式、链接和媒体显示。

资料来源与适用范围

资料来源
MDN Web Docs / Mozilla 贡献者
适用范围
请按文中版本与环境说明核对
内容语言
中文;命令、路径和错误标识保留技术原文
本地收录日期
2026-11-15
授权说明
CC BY-SA 2.5

正文与所需资源由本站本地存储。查看来源及更新记录 ↗

请按适用版本和实际日志确认原因;本站没有对每一种系统或设备逐项执行文中的操作。