Here's a very cool way of handling this: How can I remove all characters up to and including the 3rd slash in a string?How can I remove all characters up to and including the 3rd slash in a string?
My preference of the proposed solutions is
var url = "http://blablab/test/page.php"; alert(url.split("/")[3]); //-> "test"