title: Zooming iframe content
body: <p>I'm struggling to resize iframe <strong>content</strong> (within a fixed-sized iframe). I.e. I want its content to get smaller/bigger as if the browser's zoom was changed. From css experimentation I get the sense it's possible by defining the iframe page size and rescaling it to the fixed window dimensions. But I can't replicate in javascript. Any assistance appreciated.</p>
  
  <p><div class="snippet" data-lang="js" data-hide="false" data-console="true" data-babel="false">
  <div class="snippet-code">
  <pre class="snippet-code-js lang-js prettyprint-override"><code>var w = $(window).width() * .7;
  var h = $(window).height() * .7;
  $('#myiframe').width(w + 'px').height(h + 'px');
  
  function zoom(x) {
    console.log(w * x, h * x);
    // document.getElementById("myiframe").width(w).height(h);
    // document.getElementById("myiframe").style.transform = 'scale(' + z + ',' + z + ')';
  }</code></pre>
  <pre class="snippet-code-css lang-css prettyprint-override"><code>body {
    background-color: #ccc;
    overflow: hidden;
  }
  
  #iframe_container {
    background-color: pink;
    width: 70vw;
    height: 70vh;
    padding: 0;
    overflow: hidden;
  }
  
  #myiframe {
    overflow: scroll;
    border: 0;
    -ms-transform: scale(0.25);
    -moz-transform: scale(0.25);
    -o-transform: scale(0.5);
    -webkit-transform: scale(1);
    transform: scale(1);
    -ms-transform-origin: 0 0;
    -moz-transform-origin: 0 0;
    -o-transform-origin: 0 0;
    -webkit-transform-origin: 0 0;
    transform-origin: 0 0;
  }
  
  button {
    display: inline-block;
  }</code></pre>
  <pre class="snippet-code-html lang-html prettyprint-override"><code>&lt;script src="https://ajax.googleapis.com/ajax/libs/jquery/2.1.1/jquery.min.js"&gt;&lt;/script&gt;
  &lt;button type="button" onclick="zoom(1)"&gt;- ZOOM OUT&lt;/button&gt;
  &lt;button type="button" onclick="zoom(-1)"&gt;+ ZOOM IN&lt;/button&gt;
  &lt;br&gt;
  &lt;div id="iframe_container"&gt;
    &lt;iframe id="myiframe" src="./iframe.html"&gt;&lt;/iframe&gt;
  &lt;/div&gt;</code></pre>
  </div>
  </div>
  </p>