Return the current URL Use Window.location.href to get the URL of the current page. const currentURL = () => window.location.href; // EXAMPLE currentURL(); // 'https://www.google.com/' Source https://www.30secondsofcode.org/js/s/current-url