You may be able to use a ParentWindow query (referenced here) for this. I don't know of a way to query the parent document object directly but if you store the page's URL in a DOM element you should be able to access it.
Say you have something like
<div id="page_url" hidden></div>
on your webpage and then set its value to be the page's URL in the same script where you embed Retool using something like
Hi @Kabirdas,
I'm looking for something similar, is it not possible for the embedded app to see on which original domain it is without having that information in the iFrame itself?
I am also to hear back from @Kabirdas on alternatives, but from my understanding the data which a retool app has access to is encapsulated in it's own codebase and to bring in new data such as URLs/app domains it needs to receive this data from a resource/query.
You should be able to grab the URL params from your retool app and pass them into a query with dynamic JS interpolation using {{urlparams}} to grab the string and from there do some string manipulation to grab the data you need!