var index = yourstring.lastIndexOf("/") + 1;
var filename = yourstring.substr(index);
Shorter way
var filename = window.location.href.substr(window.location.href.lastIndexOf("/")+1);
var filename = url.match(/.*\/(.*)$/)[1];
var filename= url.split('/').pop()
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With