Here is a snippet I use to grab the filename from the full window location of page.
var filename = location.pathname.substr(location.pathname.lastIndexOf("/")+1,location.pathname.length);
Here is a snippet I use to grab the filename from the full window location of page.
var filename = location.pathname.substr(location.pathname.lastIndexOf("/")+1,location.pathname.length);