URL.hash
La propriété hash
de l'interface URL
retourne un USVString
contenant le caractère '#'
suivi par l'identificateur de fragment de URL.
Le fragment n'est pas décodé en pourcent. Si l'URL ne contient pas d'identificateur de fragment, la valeur de cette propriété est une chaîne de caractère vide — ""
.
Note: Cette fonctionnalité est disponible via les Web Workers
Syntaxe
js
string = object.hash;
object.hash = string;
Valeur
Un USVString
.
Exemples
js
var url = new URL(
"https://developer.mozilla.org/fr/docs/Web/API/URL/href#Examples",
);
url.hash; // Returns '#Examples'
Spécifications
Specification |
---|
URL Standard # dom-url-hash |
Compatibilité des navigateurs
BCD tables only load in the browser
Voir aussi
- L'interface
URL
dont il est contenu.