We have a nodeJS/angular 4 website which is displaying an iframe from a third party (powerBI Emebdded). We are trying to get develop a feature allowing the end user to take a screenshot of the page including the content of the iframe.
We tried the iframe2image library: https://github.com/twolfson/iframe2image
But we are facing the issue of the same origin policy:
ERROR DOMException: Blocked a frame with origin http://localhost:4200
from accessing a cross-origin frame
As we have no access to the iframe (it's a third party content generated by PowerBI iframe with a dedicated library). We can not bypass the policy by setting the window.document.domain in the iframe to the same domain.
Do you have a solution to suggest us?
contentWindow. document. body. innerHTML: It returns the HTML content of iframe body.
I think this is absolutely not possible, because there is no way to access the elements of the iframe's document. But access to this elements is necessary because all libraries which are rendering html to any form of image need to resolve the Elements inside the document to get the visuals out of it.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With