I am trying to create a dynamic Webpart that fills its data dependant on the site URL. Basically when you add the webpart to the page it will take the URL and query the data from the database.
The problem is that all webparts are located in an <iframe>
and when I use window.location.href
to get the URL I am getting the <iframe>
URL.
Is there a way to get the browser URL not the URL from the <iframe>
? Also possible if I can get the site URL.
I am using creating the Webpart with the use of SPFX and Javascript.
Thanks in advance!