Sobes.tech
Junior

How to get the current URL of the page?

sobes.tech AI

Answer from AI

// Get the location object of the current document
const url = window.location.href;

// url now contains the full string of the current URL, for example: "https://example.com/page.html?param=value#section"