Posted By

BenClayton on 04/14/10


Tagged


Versions (?)

Javascript: Find directory of file


 / Published in: JavaScript
 

  1. var url = "http://example.com/a/b/fish.html";
  2. url.substring( 0, url.lastIndexOf("/") );
  3.  
  4. // returns http://example.com/a/b

Report this snippet  

You need to login to post a comment.