window.location.href和window.location.hash的区别
window.location.href表示重定向 是完整的url地址
window.location.href
是完整的url 比如window.location.href="should be shared”表示的是重新定向 页面跳转到新的页面
可以通过window.location.href得到a标签的完整的href 比如<a href="#book">
使用href 得到完整的链接 url
window.location.hash
锚链接 相比如href 通过window.location.hash
不会跳转到新的链接 只会在当前链接里面改变锚链
<a href="#book">通过window.location.hash得不到完整的链接 URL
仅仅得到#book
感谢您的支持,我会继续努力的!
支付宝扫一扫,即可进行扫码打赏哦
857Location 对象
window.location.href和window.location.hash的区别
window.location.href表示重定向 是完整的url地址
window.location.href
是完整的url 比如window.location.href="should be shared”表示的是重新定向 页面跳转到新的页面
可以通过window.location.href得到a标签的完整的href 比如<a href="#book">
使用href 得到完整的链接 url
window.location.hash
锚链接 相比如href 通过window.location.hash
不会跳转到新的链接 只会在当前链接里面改变锚链
<a href="#book">通过window.location.hash得不到完整的链接 URL
仅仅得到#book