Retrieving a URL parameter in custom code


I want to retrieve a URL parameter in a custom code block but I don’t find any way to do it. Is that possible and how can I do this ?

Thanks in advance


Here is the function to get a Url Param (here: the recordId) from the current page where the user is.

function getUrlParam(recordId) {
    const url = new URL(window.location.href);
    return url.searchParams.get(recordId);

const idUnique = getUrlParam('recordId');

What exactly do you want to do? Any script you already have?

Thanks that works for me !