Jquery to get the name of the current html file

后端 未结 4 1977
温柔的废话
温柔的废话 2020-12-15 16:16

If you are on http://www.cnn.com/2012/11/09/opinion/brown-pakistan-malala/index.html can you get Jquery to grab the index.html?

or if you a

4条回答
  •  猫巷女王i
    2020-12-15 16:49

    function getCurentFileName(){
        var pagePathName= window.location.pathname;
        return pagePathName.substring(pagePathName.lastIndexOf("/") + 1);
    }
    

提交回复
热议问题