Getting "page" from Page Data

In all URLs for pages other than the landing (home) page, there is …/?page=“PageName”

For our application, the page a user is on is used in some logic… so right now, we have to set a property: {page: “PageName”} on page mount for every page in our app, just so we can then get this property back from Page Data and use it in our logic.

image

Question: is there not a way to get the page name from Page Data without first having to set it up as an object with explicit code?

This will do it:

UI Builder - ConsoleDemo - Backendless 2023-01-11 11-16-52

and inside of the Custom Code block do this:

The code is:

const params = new URLSearchParams(window.location.search)
return params.get('page');

Mark

:sweat_smile: thanks