How to access a URL parameter in the main URL when in an iframe

I have a form that needs to show information retrieved through a service (an article in a product database).

The form needs to show inside an iframe

I've got JS code that can read the URL, but it reads the iframe URL, not the main URL

How do I go about getting the main URL instead of the iframe URL ?

Usually

parent.location

references to the address of the main window that contains the iframe.

Thanks Oliver

So here is what I wrote

const queryString = window.parent.location.search
const urlParams = new URLSearchParams(queryString);
var showcat = urlParams.get('UNID');

here is what I get

Am I right in assuming that this error could come from the fact that the website dev environment is on the other side of the continent and so not on the same server as the VOLT server ?

Yes, the hostname of the main window and the iframe should be the same to access the main window with that code. If you can control the allow-origin headers from the page inside the iframe then it could be doable though

Ok, I'll thenput this on the backburner until both are un the same server. As for allow-origin, let's just say that this is above my paygrade of citizen JS developer !!

But thanks for the assistance, I appreciate