Created
November 15, 2013 08:05
-
-
Save Sn0wCrack/7480792 to your computer and use it in GitHub Desktop.
Grabs the name of the current document that the JavaScript file is running in.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
function getFileName() | |
{ | |
var url = document.location.href; | |
url = url.substring(0, (url.indexOf("#") == -1) ? url.length : url.indexOf("#")); | |
url = url.substring(0, (url.indexOf("?") == -1) ? url.length : url.indexOf("?")); | |
url = url.substring(url.lastIndexOf("/") + 1, url.length); | |
return url; | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment