Kmspico Download | Official KMS Activator Website [New Version 2024] Fast and Easy Converter YouTube to MP3 Online KMSAuto Net Activator Download 2024 Immediate Byte Pro Neoprofit AI Blacksprut without borders. Discover new shopping opportunities here where each link is an entrance to a world ruled by anonymity and freedom.

How to Get Current URL Using Javascript?

Hello friends, today I will tell you through experts php tutorial how you can get current url through javascript program. So let’s try to understand step to step.

Example: Get The Current URL

// program to get the URL
const url_first = window.location.href;
const url_second = document.URL;
console.log(url_first);
console.log(url_second);

Output

https://www.expertsphp.com/
https://www.expertsphp.com/

In the above program, window.location.href property and document.URL property are used to get the URL of the current page.

Both the window.location.href and the document.URL properties return the URL of the current page.