Current URL

OSCC · JavaScript, Browser · Oct 20, 2020

Returns the current URL.

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

Recommended snippets

  • URL parameters as object

    JavaScript, Browser

    Creates an object containing the parameters of the current URL.

  • Prefix CSS property

    JavaScript, Browser

    Prefixes a CSS property based on the current browser.

  • HTTP post

    JavaScript, Browser

    Makes a POST request to the passed URL.