IE9 "Invalid caller" when printing PDF in iframe

I open editable PDF format (open via acrobat plugin) in iframe:

<iframe name="iframe_content" id="iframe_content" src="mypdf.pdf"></iframe> 

There is a button that calls the following print function:

 function printContent(){ window.frames["iframe_content"].focus(); window.frames["iframe_content"].print(); } 

It works in Chrome, Safari, IE8, but not in IE9.
In IE9, I get the following error regarding the printContent() function:

 Invalid calling object 

I think this may be a trick to make it work, but I'm not sure how to make window.frames suitable in this structure: http://msdn.microsoft.com/en-us/library/ie/gg622930%28v = vs. 85% 29.aspx

UPDATE . It was decided that for this single page, the simplest solution made the browser work in IE8 compatibility mode using the <meta> and X-UA-Compatible

+6
source share
1 answer

You must put your print function on the Iframe page and call it from the parent page.

in iframe:

 function printMe() { window.print() } 

in the parent (assuming this is the first iframe on your page):

 frames[0].printMe() 
-3
source

Source: https://habr.com/ru/post/918684/


All Articles