【发布时间】:2017-11-28 00:27:10
【问题描述】:
我试图使用 javascript 获取当前页面 pathname。我能够得到它,但我用 Forward Slash / 得到它。我想从变量中删除 /。
这是我尝试过的代码。 :)
var URLPath = window.location.pathname;
alert(URLPath);
<script src="https://ajax.googleapis.com/ajax/libs/jquery/2.1.1/jquery.min.js"></script>
【问题讨论】:
标签: javascript url pathname