Visit stackoverflow.com/#_=_ and window.location.hash evaluates to #_=_. Fine.
stackoverflow.com/#_=_
window.location.hash
#_=_
Now execute window.location.hash = \'\'>
window.location.hash = \'\'>
To answer the second question (removing the # without a page refresh):
#
history.pushState('', document.title, window.location.pathname);