The code is very simple, so I won’t go into too much nonsense. Here is the code:
// Get the name of the current page (without suffix)
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)
function getPageName2()
{
var strUrl=location.href;
var arrUrl=strUrl.split("/");
var strPage=arrUrl[arrUrl.length-1];
Return strPage;
}