Getting the referring URL

Is it possible to get the referring URL of a Retool app? For example, if I click on a link to my Retool app from https://mycompany.com/admin/tools, I would like to be able to retrieve what that referring URL was from within the app.

I have tried document.referrer, but this only ever returns my Retool base URL.

1 Like

Hey @nolan.picini, welcome to the community :wave:

I'm not sure this is possible (retool team please correct me if I'm wrong).

Would URL params work for you? You could tag your outgoing links with a specific parameter which you can access in your app via the urlparams object.

So if your link to the app has a ?origin=admin param in the URL you could access that in your retool JS query with: urlparams.origin.

Not ideal as you would need to tag all your URLs but can't see any other way atm.

Thanks for the response, @minijohn! I don't have control over the outgoing links, unfortunately, and I really need the entire URL (not just a param), so I may go with a different solution.

Try looking at retoolContext in global state. I was able to build the apps URL with the values stored there