What is the problem of using location.href and location.reload at the same time?

let type=item.type,
url = location.protocol + "//" + location.host + "/web/"+type+"/show.html-sharp/" + this.activity.activity_id+"/"+undefined+"/"+this.yiye.activity_id;
location.href = url;

when the type changes above, the page jumps normally, but only when the hash changes, the page will not be refreshed, so I add the following sentence

location.reload();

now the hash value has changed, and the page will be refreshed, but when the type changes, the page will not jump and just refresh. What is the reason for this?

let pathname =location.pathname
location.href = url;
if(url.indexOf(pathname)!==-1){
   location.reload();
}

in the end, I solved the problem by judging whether the path has changed to call reload ()

.
Mar.19,2021
Menu