首页 > 其他 > 详细

location中的各个属性

时间:2021-01-18 14:40:21      阅读:22      评论:0      收藏:0      [点我收藏+]

技术分享图片

 

 

 

http://172.16.20.218:8080/m/MGU20201126001-001/index.html?username=admin&password=123#/write   
浏览器输入这个链接,这个url中location的属性如下:

hash: "#/write"
host: "172.16.20.218:8080"
hostname: "172.16.20.218"
href: "http://172.16.20.218:8080/m/MGU20201126001-001/index.html#/write"
origin: "http://172.16.20.218:8080"
pathname: "/m/MGU20201126001-001/index.html"
port: "8080"
protocol: "http:"
search: "?username=admin&password=123"

 

小窍门  :

  需要获取当前url 不需要参数的话,那就是   location.origin+location.pathname

  需要获取当前 完整的url,那就是   location.href

location中的各个属性

原文:https://www.cnblogs.com/520BigBear/p/14292356.html

(0)
(0)
   
举报
评论 一句话评论(0
关于我们 - 联系我们 - 留言反馈 - 联系我们:wmxa8@hotmail.com
© 2014 bubuko.com 版权所有
打开技术之扣,分享程序人生!