js variable for current url\'s filename

/ Published in: JavaScript
Save to your folder(s)

Copy this code and paste it in your HTML
  1. // variable for the current filename in the URL
  2. var filename = location.pathname.substr(location.pathname.lastIndexOf("/") + 1, location.pathname.length);

Report this snippet


RSS Icon Subscribe to comments

You need to login to post a comment.