Posted By

mmstudio on 12/03/10


Tagged

filename


Versions (?)

Get the file name of the page


 / Published in: JavaScript
 

  1. function getFileName() {
  2. var url = document.location.href;
  3. url = url.substring(0, (url.indexOf("#") == -1) ? url.length : url.indexOf("#"));
  4. url = url.substring(0, (url.indexOf("?") == -1) ? url.length : url.indexOf("?"));
  5. url = url.substring(url.lastIndexOf("/") + 1, url.length);
  6. return url;
  7. }

Report this snippet  

You need to login to post a comment.