For example, let's say http://www.google.com/Stack/overflow
In this above example, overflow is the last character. I need to fetch that overflow character
Please help me to achieve this
window.location.href
For example, let's say http://www.google.com/Stack/overflow
In this above example, overflow is the last character. I need to fetch that overflow character
Please help me to achieve this
window.location.href
Try this:
window.location.href.split('/').pop();
This splits the URL and returns the last element of that array using .pop()
.