Skip to main content
cancel
Showing results for 
Search instead for 
Did you mean: 

Enhance your career with this limited time 50% discount on Fabric and Power BI exams. Ends August 31st. Request your voucher.

Reply
muy
Frequent Visitor

Add "allow-same-origin" value to iframe's attribute sandbox

I'm developing a custom visual for map visualization and encounter the following error: 

 

"Uncaught DOMException: Failed to read the 'sessionStorage' property from 'Window': The document is sandboxed and lacks the 'allow-same-origin' flag."

 

So is there anyway to add the "allow-same-origin" flag to the iframe that load my visual?

9 REPLIES 9
NUCRjs2
Regular Visitor

The map is possible because there is a mapbox visual training for Power BI that uses them.  Something else is causing the error.  How can we trouble shoot?

 

Mapbox Tutorial Power BI 101 https://www.youtube.com/watch?v=0w589b5_Z3o 

jgreg14
Frequent Visitor

Hey @ryanbaumann - how did you get this working?

Cubist
Advocate II
Advocate II

There is good news and bad news.  

 

The bad news is that what you're asking for, adding the "allow-same-origin" permission to sandboxed visuals, has a snowballs chance in hell of happening.  It's considered by many to be risky from a security perspective, and Microsoft has to have insane vigilence around security, I can't see them ever doing this.

 

The good news is there are workarounds for these limitations, one of them might allow you to still meet your goal.  I've been wanting to get around to blogging about PBI sandboxing, and developing custom visuals in general, maybe something like Power BI Custom Visuals In-Depth, but you know it's tough to get free time...

 

What I would suggest in your case is to let us know, why you want to use session storage?  What user level requirement is driving it?  That way people here can offer suggestions on how to achieve what you need technically while perserving the experience for your end users.

Thanks for replying! I managed to get this to work without needing the allow-same-origin flag. My custom visual is here https://github.com/ryanbaumann/mapboxgl-powerBI.

The solution did not have to do with the allow same origin flag. Instead I had an error that was not written to the debug console which caused the custom visual to not load properly. I still see the allow same origin error, but it does not effect my app.

Thank you!
ryanbaumann
Frequent Visitor

I could use this as well.  I receive this error in the console while developing any Custom Visual using Chrome v60.

Power BI Custom Visuals API doesn't allow to use local storage, session storage and cookie due to security aspects.

You might keep a session in Power BI capabilities' properties.

 

Ignat Vilesov,

Software Engineer

 

Microsoft Power BI Custom Visuals

pbicvsupport@microsoft.com

v-chuncz-msft
Community Support
Community Support

@muy,

 

Based on my experience, this can‘t be achieved. You could also reach out for help at GitHub.

Community Support Team _ Sam Zha
If this post helps, then please consider Accept it as the solution to help the other members find it more quickly.

Thanks for the reply Sam.

 

I had spent some time looking into this, but couldn't find any solutions as well. 

@muy,

 

You may keep an eye on Custom Visuals blog for the latest info.

Community Support Team _ Sam Zha
If this post helps, then please consider Accept it as the solution to help the other members find it more quickly.

Helpful resources

Announcements
July PBI25 Carousel

Power BI Monthly Update - July 2025

Check out the July 2025 Power BI update to learn about new features.

Join our Fabric User Panel

Join our Fabric User Panel

This is your chance to engage directly with the engineering team behind Fabric and Power BI. Share your experiences and shape the future.

June 2025 community update carousel

Fabric Community Update - June 2025

Find out what's new and trending in the Fabric community.