@JaySODec 06, 2022 — #You can use the window.location object, which contains information about the current URL. This object has several properties that you can use to access different parts of the URL, such as the protocol (e.g. "https:"), the hostname (e.g. "www.example.com"), the path (e.g. "/path/to/page"), the query string (e.g. "?key1=value1&key2=value2"), and the fragment identifier (e.g. "#top").
const currentUrl = window.location; const protocol = currentUrl.protocol; // e.g. "https:" const host = currentUrl.host; // e.g. "www.example.com" const pathname = currentUrl.pathname; // e.g. "/path/to/page" const search = currentUrl.search; // e.g. "?key1=value1&key2=value2" const hash = currentUrl.hash; // e.g. "#top"
const myURL = 'https://google.com/?ham=true&number=10' const parsedURL = new URL(myURL)