[英]How to find current page url (like “index.html”)?
With string http://www.example.com/section_one/index.html
how can I return index
using RegExp? 使用字符串http://www.example.com/section_one/index.html
如何使用RegExp返回index
?
PS: Returning index.html
is accepted too. PS:也返回index.html
。
You don't need to use regex for that. 您不需要为此使用正则表达式。 Its simple: 这很简单:
var url = document.URL;
var currentPage= url.split("/").pop();
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.