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


Comments


You need to login to view comments.