JavaScript Program To Get The Current URL

bookmark

// program to get the URL

const url1 = window.location.href;
const url2 = document.URL;
console.log(url1);
console.log(url2);

 

Output

https://www.google.com/
https://www.google.com/