Could someone recommend a way to get page name from a url using JavaScript?
For instance if I have:
http://www.cnn.com/news/1234/news.html?a=1&b
You might want to also find file paths on a local disk, and you might not want to include any hash or get strings in the path-
String.prototype.fileName= function(){
var f, s= this.split(/[#\?]/, 1)[0].replace(/\\/g,'/');
s= s.substring(s.lastIndexOf('/')+ 1);
f= /^(([^\.]+)(\.\w+)?)/.exec(s) || [];
return f[1] || '';
}