Can you please let me know how to clean a hashed URL like this
domain.com/2.html#box1
to
domain.com/2.html
by removing the #box1 (the # and everything after that). I already tried this
if (location.href.indexOf("#") > -1) {
    location.assign(location.href.replace(/\/?#/, "/"));
} 
but it generate a URL like
domain.com/2.html/box2
 
    