I have started to get into web development and I have come across document.location.hash. I know what a hash is so to me it sounds like the hash value of the whole document, maybe used for comparing pages, caching? One famous site gives this explanation:
Definition and Usage The hash property returns the anchor portion of a URL, including the hash sign (#)
An anchor is a place at the document where the programmer can make a link to if I got it right?
I have also come across this use of document.location.hash in some security related scripts and i have seen questions here at stack overflow where its used but never really have the focus and therefore don't get explained in great detail.
So what is this really? And where is it used? Please also give some example of a general usercase if it exists
location.hash
: "If the... current location has a fragment identifier, then the value of thehash
attribute of [window.location
] must be the string concatenation of the hash mark (#
) and the fragment identifier. " - apsillers