Get the current url in Javascript.

1 year ago23k times

To get the current url use the following code.


let url = new URL(window.location.href);
console.log(url.href);

Add Answer

Add a codeAdd Code
Remove adsremove

Latest codes

view all

Latest Snippets

view all