use window.location.href
to get the current URL
//It returns the current url of the webpage
let getCurrentUrl = window.location.href;
//get url in console
console.log("getCurrentUrl", getCurrentUrl);
Unveiling the Web: A Journey through HTML, CSS, and JavaScript
use window.location.href
to get the current URL
//It returns the current url of the webpage
let getCurrentUrl = window.location.href;
//get url in console
console.log("getCurrentUrl", getCurrentUrl);