-
-
Save islahh/efadfb062d8122c6d0934ca9b2dbe36d 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