Warning: file_get_contents(/data/phpspider/zhask/data//catemap/2/jquery/77.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
Javascript 在jquery/JS中获取uri LocalPath?_Javascript_Jquery - Fatal编程技术网

Javascript 在jquery/JS中获取uri LocalPath?

Javascript 在jquery/JS中获取uri LocalPath?,javascript,jquery,Javascript,Jquery,用一个简单的问题解决一个简单的问题。我有一个字符串,在C语言中,我可以通过uri访问LocalPath 如何在jquery或javascript中获取LocalPath?(本地路径:“/asas”) {} 嗯,在浏览器中,“window.location”对象有一个“pathname”属性,这(我想)就是你想要的。“协议”、“主机”、“端口”等还有其他属性: 现在,这是您正在使用的页面的本地路径;换句话说,这不是一种获取空间中任何旧URL的本地路径的通用方法 AbsolutePath: "/as

用一个简单的问题解决一个简单的问题。我有一个字符串,在C语言中,我可以通过uri访问LocalPath

如何在jquery或javascript中获取LocalPath?(本地路径:“/asas”)

{}

嗯,在浏览器中,“window.location”对象有一个“pathname”属性,这(我想)就是你想要的。“协议”、“主机”、“端口”等还有其他属性:

现在,这是您正在使用的页面的本地路径;换句话说,这不是一种获取空间中任何旧URL的本地路径的通用方法

AbsolutePath: "/asas"
AbsoluteUri: "http://z.com/asas?sadfdsgfg"
Authority: "z.com"
DnsSafeHost: "z.com"
Fragment: ""
Host: "z.com"
HostNameType: Dns
IsAbsoluteUri: true
IsDefaultPort: true
IsFile: false
IsLoopback: false
IsUnc: false
LocalPath: "/asas"
OriginalString: "http://z.com/asas?sadfdsgfg"
PathAndQuery: "/asas?sadfdsgfg"
Port: 80
Query: "?sadfdsgfg"
Scheme: "http"
Segments: {string[2]}
UserEscaped: false
UserInfo: ""