Files
30-seconds-of-code/snippets/currentURL.md
2022-02-13 18:10:27 +02:00

318 B

title, tags, firstSeen, lastUpdated
title tags firstSeen lastUpdated
Current URL browser,beginner 2017-12-18T11:05:03+02:00 2020-10-20T11:46:23+03:00

Returns the current URL.

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