I learned "window.location.hash" new and tried in my jquery code instead of "window.location.href" and both of them gave same results.
Code is here :
window.location.href = ($(e.currentTarget).attr("href"));
window.location.hash = ($(e.currentTarget).attr("href"));
What is the difference between them?
hash
andhref
are both properties of thewindow.location
object.hash
is the part of the URL from the#
on (or an empty string if there is no#
), whilehref
is a string representation of the whole URL.