I am trying to print directly from a url which is a src of an iframe
<iframe id="pagetwo" src="https://78.media.tumblr.com/b90ee054017d4ddd25a4c4161127c7d4/tumblr_p8iyzdMhuZ1qzooxpo1_1280.jpg" width="550" height="700"></iframe>
<a id="downloadlink2" class="link_print" href="" target="_blank" onclick="printDocument('pagetwo')">
<img src="assets/print-button.png" alt="">
</a>
While printing this script:
function printDocument(iframe) {
console.log(window.frames);
var iframe = document.getElementById(iframe);
if (iframe.src) {
var frm = iframe.contentWindow;
frm.focus();// focus on contentWindow is needed on some versions
frm.print();
}
}
I am getting this error:
Uncaught DOMException: Blocked a frame with origin "http://localhost:8080" from accessing a cross-origin frame.
However when I am putting image in local, then it is working perfect