Location: 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 Location
-Schnittstelle ist eine Zeichenkette, die ein "#"
gefolgt vom Fragment-Identifikator der URL enthält. Wenn die URL keinen Fragment-Identifikator hat, enthält diese Eigenschaft eine leere Zeichenkette, ""
.
Weitere Informationen finden Sie unter URL.hash
.
Wert
Eine Zeichenkette.
Beispiele
Angenommen, der Benutzer hat https://example.org#examples
aufgerufen, dann gibt der folgende Code #examples
aus:
const result = location.hash;
console.log(result);
Spezifikationen
Specification |
---|
HTML # dom-location-hash-dev |
Browser-Kompatibilität
Report problems with this compatibility data on GitHubdesktop | mobile | server | |||||||||||
---|---|---|---|---|---|---|---|---|---|---|---|---|---|
hash |
Legend
Tip: you can click/tap on a cell for more information.
- Full support
- Full support
- No support
- No support
- User must explicitly enable this feature.