Difference between [removed] and location.href

前端 未结 6 1419
一个人的身影
一个人的身影 2020-12-01 07:35

I am confused as to the difference between window.location and location.href. Both appear to be acting in the same way.

What is the differe

6条回答
  •  醉话见心
    2020-12-01 07:50

    window.location has other properties aside from href but if you assign window.location a URL it will redirect.

    You can see all of its properties in MDN (like search, protocol, hash, ...)

提交回复
热议问题