-
-
Save umkasanki/840ccb671507163f0837c4eb885c7be4 to your computer and use it in GitHub Desktop.
Get Last Segment of a URL in Javascript
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
var pageURL = window.location.href; | |
var lastURLSegment = pageURL.substr(pageURL.lastIndexOf('/') + 1); | |
console.log(lastURLSegment); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment