Get data using current URL with JavaScript
You can get the URL object using window.location.href like this:
let url = new URL(window.location.href)
Then, parse that URL with split to get the data you need:
let id = url.pathname.split('/')[2]
In this case, the URL I got was http://127.0.0.1:8...
blog.kellenbaker.com1 min read