Note that there are some explanatory texts on larger screens.

plurals
  1. POPrint an iFrame using document.frames in Firefox
    primarykey
    data
    text
    <p>This is driving me crazy.</p> <p>I've been through several questions on here and other websites and cannot get this to work.</p> <p>I have an iFrame within my parent page, containing a PDF document.</p> <p>The iFrame (and PDF) is small, so the Adobe Reader navigation is hidden making it impractical to use the Print function within Adobe Reader.</p> <p>So, I want a button (which has to be in the Parent frame) which can trigger <code>Print</code> on the iFrame window.</p> <p><a href="https://stackoverflow.com/questions/10165821/print-a-pdf-iframe-in-firefox">print a PDF Iframe in firefox</a></p> <p><a href="https://stackoverflow.com/questions/7130299/how-to-print-pdf-in-iframe-using-javascript-in-ie6">How to print pdf in iframe using javascript in ie6?</a></p> <p>and a few other have similar suggestions.</p> <p>Using <strong>Firefox</strong></p> <pre><code>document.getElementById('loyaltyBadge').focus(); document.getElementById('loyaltyBadge').contentWindow.print(); </code></pre> <p>Does nothing</p> <pre><code>document.frames['loyaltyBadge'].focus(); document.frames['loyaltyBadge'].contentWindow.print(); </code></pre> <p>Does nothing</p> <pre><code>document.frames.loyaltyBadge.focus(); document.frames.loyaltyBadge.contentWindow.print(); </code></pre> <p>Returns <code>document.frames is undefined</code>... as does:</p> <pre><code>document.loyaltyBadge.print(); </code></pre> <p>Although this works in <code>Chrome</code></p> <p>I don't want to auto-print on load, but I need a print button.</p> <p>All the lines above are being wrapped in:</p> <pre><code>$('#printFrame').click(function () { }); </code></pre> <p>The button having an id of <code>printFrame</code> and the frame itself has an ID (and name) of <code>loyaltyBadge</code></p>
    singulars
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    plurals
    1. This table or related slice is empty.
    1. This table or related slice is empty.
 

Querying!

 
Guidance

SQuiL has stopped working due to an internal error.

If you are curious you may find further information in the browser console, which is accessible through the devtools (F12).

Reload