I have this URL generated by my vue.js app
http://localhost:8080/#/url-groups
I need to access url-groups
I've tried
const firstSegment = new URL(window.location.href).pathname.split('/#/')
I kept getting '/'
I've also tried :
const firstSegment = new URL(window.location.href).pathname.split('#'); console.log(firstSegment);
VM21687:1 ['/']
const firstSegment = new URL(window.location.href).pathname.split('/#/'); console.log(firstSegment);
VM21719:1 ['/']
const firstSegment = new URL(window.location.href).pathname.split('/'); console.log(firstSegment);
VM21751:1 (2) ['', '']
Can someone pls correct me ?
Via Active questions tagged javascript - Stack Overflow https://ift.tt/2FdjaAW
Comments
Post a Comment