The code is very simple, so I don’t talk much nonsense. I will give the code:
The code copy is as follows:
// Take the current page name (without the suffix name)
function getPageName1()
{
var a = location.href;
var b = a.split("/");
var c = b.slice(b.length-1, b.length).toString().split(".");
return c.slice(0, 1);
}
//Get the current page name (with suffix name)
function getPageName2()
{
var strUrl=location.href;
var arrUrl=strUrl.split("/");
var strPage=arrUrl[arrUrl.length-1];
return strPage;
}