Change page title

Is it possible to dynamically change or even access the document title?
I'd like to have the title/tab in the browser show the record name that's being viewed, so that the user can see which is which when they have multiple tabs/records open.

I've tried document.title and document.querySelector('title') within javascript scripts/queries inside Retool but it doesn't work (doesn't seem to error either). These commands work from the console, but I'm guessing the scope of the app won't allow it, unless there's some other workaround?

1 Like

Hey @dcartlidge!

That's correct, all the JavaScript you write within Retool runs in a sandboxed environment that doesn't have access to the document object for the app. It is possible to dynamically set the title of the page, however that is an Enterprise only feature:

1 Like

Ahh thanks for confirming. It would be a useful feature but definitely isn't worth >5 times the monthly fee

With the custom title enabled, how can I access the value to display on the page e.g. within a shared header module? {{ document.title }} does not work.

Hey @Ara!

You might try doing this by creating a global within your app, either using Preloaded JavaScript or a Temporary State, then referencing that variable using {{}} in the app title field as well as in your header module. Do you think that could work for you?

1 Like