HTML tutorial
CSS3 tutorial
Bootstrap tutorial
JavaScript tutorial
JQuery tutorial
AngularJS tutorial
React tutorial
NodeJS tutorial
PHP tutorial
Python tutorial
Python3 tutorial
Django tutorial
Linux tutorial
Docker tutorial
Ruby tutorial
Java tutorial
C tutorial
C ++ tutorial
Perl tutorial
JSP tutorial
Lua tutorial
Scala tutorial
Go tutorial
ASP.NET tutorial
C # tutorial
Get the anchor part of the URL
The location.hash
property sets or returns the anchor part of a URL, including the hash
sign (#).
When location.hash
is used to set the anchor part,
do not include the hash sign (#).
Return the hash property:
Set the hash property:
Parameter | Description |
anchorname | The anchor part of a URL. |
Type | Description |
A string | The anchor part of the URL, including the hash sign (#). |
location.hash
is supported in all browsers:
Chrome | IE | Edge | Firefox | Safari | Opera |
Yes | Yes | Yes | Yes | Yes | Yes |