Forum Discussion
Capture Screenshot of Custom Visual with Button
Hi Anonymous
I wanted to follow up and thank you for your earlier response to my question about using html2canvas in my Power BI custom visual!
The error I am encountering is:
Uncaught (in promise) SecurityError: Failed to read a named property 'document' from 'Window': Blocked a frame with origin "null" from accessing a cross-origin frame.
From my understanding, this issue is happening because Power BI hosts custom visuals inside an iframe. This is likely what’s causing the problem, as html2canvas tries to access the visual's content and is blocked due to cross-origin policies.
Unfortunately, I'm not sure how to resolve this. Is there any approach I can take to capture a screenshot of the visual? I’ve tried using the useCORS and allowTaint options in html2canvas, but that doesn’t seem to fix the issue.
If anyone has any insights or possible workarounds for dealing with this iframe sandboxing limitation, I would really appreciate your help!
Thanks again!
Best regards,