console.log(window.location.origin);//页面的来源
console.log(window.location.hostname);//获取主机名
console.log(window.location.port);//端口号
console.log(window.location.protocol);//协议
console.log(window.location.pathname);//根目录下的路径
console.log(window.location.href);//返回完整的url
console.log(window.location.hash);//返回从#开始的锚点
console.log(window.location.search);//返回?后面的信息
前端路线--H5篇 获取路径
最新推荐文章于 2024-07-23 10:37:19 发布