title: Unable to print an iframe on IE using JavaScript, prints parent page instead
body: <p>I have the following JavaScript code:</p>
  
  <pre><code>$(document).ready(function() {
      $('a#print_button').click(function(event) {
          event.preventDefault();
  
          var print_url = 'print.html';
  
          if ($('#print_page').length == 0) {
              $("body").append('&lt;iframe id="print_page" name="print_page" src=' + print_url + ' style="display: none; @media print { display: block; }"&gt;&lt;/iframe&gt;');
          } else {
              $('#print_page').attr("src", print_quote_url);
          }
  
          $('#print_page').on("load", function() {
              frames["print_page"].focus();
              frames["print_page"].print();
          });
      });
  });
  </code></pre>
  
  <p>It works on Chrome and Firefox. But when I click on the button on IE, it prints the parent page, instead of printing the iframe.</p>