[removed] Setting location.href versus location

后端 未结 7 1792
野性不改
野性不改 2020-11-22 17:16

When would you set location to a URL string versus setting location.href?

location = \"http://www.stackoverflow.com\";
7条回答
  •  生来不讨喜
    2020-11-22 17:45

    Just to clarify, you can't do location.split('#'), location is an object, not a string. But you can do location.href.split('#'); because location.href is a string.

提交回复
热议问题