Thursday, March 13, 2014

Get page name from URL, using Javascript


You can use following function to retrieve the current page name from the URL.

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

No comments:
Write comments
Recommended Posts × +