小编use*_*252的帖子

我想使用jQuery来获取位置和window.location的第一个文件夹

我想获取位置和第一个文件夹,如:

http://www.example.com/test/

var $location = window.location.href;
alert ($location);
Run Code Online (Sandbox Code Playgroud)

这回来了

http://www.example.com/test/location-test.html
Run Code Online (Sandbox Code Playgroud)

所以我希望它能将所有内容归还为"test /",所以我最终只能:

http://www.example.com/test/
Run Code Online (Sandbox Code Playgroud)

提前致谢!

jquery hostname window.location

8
推荐指数
1
解决办法
8729
查看次数

标签 统计

hostname ×1

jquery ×1

window.location ×1