[removed].href vs clicking on an Anchor

前端 未结 6 699
鱼传尺愫
鱼传尺愫 2020-12-03 07:17

What\'s the difference between clicking on:


vs.

calling window.location.href = ...

?

6条回答
  •  遥遥无期
    2020-12-03 07:59

    With the anchor you can specify the target property, but with window.location.href you can't. Generally the anchor is used when a user wants to redirect the browser to another location, window.location.href is used when the redirection is done using javascript.

提交回复
热议问题