HTMLAreaElement: hash-Eigenschaft

Baseline Widely available

This feature is well established and works across many devices and browser versions. It’s been available across browsers since July 2015.

Die hash-Eigenschaft der Schnittstelle HTMLAreaElement ist ein String, der ein "#" gefolgt vom Fragmentidentifikator des href-Attributs des <area>-Elements enthält. Wenn die URL keinen Fragmentidentifikator hat, enthält diese Eigenschaft einen leeren String, "".

Weitere Informationen finden Sie unter URL.hash.

Wert

Ein String.

Beispiele

Angenommen, dieses HTML:

html
<map name="infographic">
  <area
    id="mdn-circle"
    shape="circle"
    coords="130,136,60"
    href="https://developer.mozilla.org/#ExampleSection"
    alt="MDN" />
</map>

<img
  usemap="#infographic"
  src="/media/examples/mdn-info.png"
  alt="MDN infographic" />

Dann können Sie den Hash des Area-Links so abrufen:

js
const area = document.getElementById("mdn-circle");
area.hash; // '#ExampleSection'

Spezifikationen

Specification
HTML
# dom-hyperlink-hash-dev

Browser-Kompatibilität

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
hash

Legend

Tip: you can click/tap on a cell for more information.

Full support
Full support
See implementation notes.

Siehe auch