0

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!

0

I found the solution. Simply taking the site URL from the current context: this.context.pageContext.web.absoluteUrl

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.