Return to Snippet

Revision: 37780
at December 17, 2010 01:06 by mooparmghor

Initial Code
function GetCurrentPageName(){
	var url = window.location.pathname;
	var urlLength = url.length;
	var lastSlashLocation = url.lastIndexOf('/');
	//Make sure the last char in the path isn't '/'
	if (urlLength - lastSlashLocation <= 1)
		url = url.substring(0,lastSlashLocation);
	var pageName = url.substring(url.lastIndexOf('/') + 1);  
	return pageName;

Initial URL

Initial Description
Get current page name (file name) with extension (if any).

Initial Title
Get Current Page Name

Initial Tags

Initial Language