Welcome to ShenZhenJia Knowledge Sharing Community for programmer and developer-Open, Learning and Share
menu search
person
Welcome To Ask or Share your Answers For Others

Categories

Take this code snippet for example:

window.location.href = 'mysite.htm#images';

Already being on the site mysite.htm and triggering the reload thru location.href won't reload the page but jump to the anchor named within the URL.

I need a mechanism to truly reload the page. Any ideas?

PS: I tried location's other methods but none of them does the trick :(

EDIT
Don't hang on the filetype htm. I'd need it for dynamic sites as well.

See Question&Answers more detail:os

与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…
thumb_up_alt 0 like thumb_down_alt 0 dislike
615 views
Welcome To Ask or Share your Answers For Others

1 Answer

After you set the specified URL into location, issue window.location.reload(true). This will force browser to reload the page.


与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…
thumb_up_alt 0 like thumb_down_alt 0 dislike
Welcome to ShenZhenJia Knowledge Sharing Community for programmer and developer-Open, Learning and Share

548k questions

547k answers

4 comments

86.3k users

...