网址中的FileName(不含查询字符串) [英] FileName from url excluding querystring

查看:78
本文介绍了网址中的FileName(不含查询字符串)的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我有一个网址:

http://www.xyz.com/a/test.jsp?a=b&c=d

如何获取它的test.jsp?

推荐答案

这应该做到:

var path = document.location.pathname,
    file = path.substr(path.lastIndexOf('/'));

参考: document.location substr 查看全文

登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆