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

View in English Always switch to English

WorkerLocation:hash 属性

Baseline Widely available

This feature is well established and works across many devices and browser versions. It’s been available across browsers since ⁨2015年7月⁩.

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

WorkerLocation 对象的 hash 属性返回该 Worker 所处位置的 hash 部分。

字符串。

示例

js
// 在位于页面 https://developer.mozilla.org/zh-CN/docs/Web/API/WorkerLocation/hash#示例 上的 Web Worker 中
const result = location.hash; // 返回“#%E7%A4%BA%E4%BE%8B”

规范

Specification
HTML
# dom-workerlocation-hash

浏览器兼容性

参见