user1404602
user1404602

Reputation: 55

Anchor Javascript Window Reloading

all ready link here : site.com/en/#gone_videoid

new url :

var url = 'en/#gone_videoid2';
window.location.href= url;

coming url : site.com/en/#gone_videoid2

but window refeshing when refering location href i want work like this click

<a href="en/#gone_videoid2">video</a>

this clickig not refeshing window

Upvotes: 1

Views: 79

Answers (2)

user1404602
user1404602

Reputation: 55

location.href=newUrl

no refreshing window

Upvotes: 0

lrsjng
lrsjng

Reputation: 2625

use window.location.hash instead of window.location.href:

window.location.hash = "#gone_videoid2"

will only update the hashtag of the current URL

Upvotes: 1

Related Questions