I have just read some concept about window.location property and method. And I know that
1. window.location.href = "http://google.com"
2. window.location.assign("http://google.com")
3. window.location.replace("http://google.com")
are all can redirect our page to the target url, the only difference is that window.location.replace doesn't record the history, so we cannot get back to the previous page directly.
Now I just wondering, what's is the difference between window.location.href
and <a href="http://google.com">Google</a>
, the <a>
tag also records the history.
And for what situation do we use them respectively?