Last active
August 29, 2015 14:15
-
-
Save jorgepinon/fb90c20f1f0b097c13e7 to your computer and use it in GitHub Desktop.
returns the first segment of the current url
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
function getFirstSegment() { | |
var path = window.location.pathname; | |
seg1 = path.split("/")[1]; | |
return seg1; | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment