Files
30-seconds-of-code/snippets/currentURL.md
2020-09-15 21:52:00 +03:00

245 B

title, tags
title tags
currentURL browser,url,beginner

Returns the current URL.

  • Use window.location.href to get the current URL.
const currentURL = () => window.location.href;
currentURL(); // 'https://www.google.com/'