以下列出均为常用(转自地址为:https://blog.csdn.net/pengShuai007/article/details/78357238?locationNum=9&fps=1 1、设置或获取整个 URL 为字符串 window.location.href ...
设置或获取整个 URL 为字符串 设置或获取 URL 的协议部分 设置或获取 URL 的主机部分 设置或获取与 URL 关联的端口号码 设置或获取与 URL 的路径部分 就是文件地址 设置或获取 href 属性中跟在问号后面的部分 设置或获取 href 属性中在井号 后面的分段 转自:https: blog.csdn.net pengShuai article details locationNu ...
2019-07-18 17:10 0 832 推荐指数:
以下列出均为常用(转自地址为:https://blog.csdn.net/pengShuai007/article/details/78357238?locationNum=9&fps=1 1、设置或获取整个 URL 为字符串 window.location.href ...
1,设置或获取对象指定的文件名或路径。console.log(window.location.pathname)2,设置或获取整个 URL 为字符串。console.log(window.location.href);3,设置或获取与 URL 关联的端口号码。console.log ...
转自:博客园(幽篁晓筑) ...
转 : https://www.cnblogs.com/ysx215/p/12024621.html ...
首先,先把获取各参数的方式再写一遍,相信大家都耳熟能详,就写几个常用的吧。 以此网址https://i.cnblogs.com/EditPosts.aspx?opt=1为例: 1. var url=window.location.href console.log(url)--> ...
var url = window.location.href//获取url地址 var str = url.substr(1); var strs= str.split("&"); strs[0].split("=")[1]; var ...
href 完整的 URL http://172.18.8.64:3000/#/postDetails?postId=24273 protocol 协议 ...
一、js获取当前域名方法1: var domain = document.domain;方法2:var domain = window.location.host; 二、获取端口号var port = location.port; //获取端口号var host = location.host ...