Posted By

markux on 02/05/11


Tagged

url path folder


Versions (?)

Extract folder from window.location.pathname


 / Published in: JavaScript
 

  • example: google.com/reader/view/

folder = /reader

  • example: google.com/reader

folder = /

  • example: google.com

folder = ''

  1. var folder = window.location.pathname.substring(window.location.pathname.indexOf('/', 0), window.location.pathname.indexOf('/', 1));

Report this snippet  

You need to login to post a comment.