Chrome userscript error: “Unsafe JavaScript attempt to access frame”

It’s true that ordinary javascript cannot access iframe content, that’s on a different domain, for security reasons. However, this by no means stops userscripts in Chrome, Tampermonkey or Greasemonkey. You can process iframed content in a userscript because Chrome (and Firefox) process iframe’d pages just as if they were the main page. Accounting for that, … Read more

Print iframe content in Opera and Chrome

This is a known bug in Opera. In addition to the above ideas for workarounds, you may want to play with something like this: var clone=document.documentElement.cloneNode(true) var win=window.open(‘about:blank’); win.document.replaceChild(clone, win.document.documentElement); win.print(); I have not tested this but it should create a copy of the page in a popup window and print it, without having to … Read more

Can Cross-Origin Resource Sharing headers authorize X-Domain IFRAME access?

CORS doesn’t let you do that, but you can use cross-document messaging to send strings between iframes and their parent windows even on different domains, and use that to communicate. Most browsers support this although Internet Explorer’s way differs from the others‘. Assuming what you want is to have the iframe announce to the parent … Read more

Detect when an iframe is loaded

I wonder if it would require some significant changes in both frontend and backend code, but have you considered using AJAX? The workflow would be something like this: user sends AJAX request to start file generating and frontend constantly polls it’s status from the server, when it’s done – show a download link to the … Read more

How can I detect a Scrollbar presence ( using Javascript ) in HTML iFrame?

var root= document.compatMode==’BackCompat’? document.body : document.documentElement; var isVerticalScrollbar= root.scrollHeight>root.clientHeight; var isHorizontalScrollbar= root.scrollWidth>root.clientWidth; This detects whether there is a need for a scrollbar. For the default of iframes this is the same as whether there is a scrollbar, but if scrollbars are forced on or off (using the ‘scrolling=”yes”https://stackoverflow.com/”no”’ attribute in the parent document, or CSS … Read more