I want to get ‘second’ in the following sample web address.
http://www.mywebsite.com/first/sedond/third.html
“first” can be any length. i.e. contact, images etc
If I use document.location.pathname, I get “/first/sedond/third.html”.
If I use document.location.pathname[1], I get “f”.
How can I get “first” part by using document.location.pathname?
Thanks in advance.
You asked two different questions – here are both answers. 😎
“How can I get ‘first’ part” – like this:
“I want to get ‘second'” – like this: