title: Temporarily unzip a file to view contents within a browser
body: <p>I want to unzip a file that contains an html page, css, and js directories. I want to unzip this temporarily and view the html in an iFrame, preferrably. I am using jszip which is working. I got the html to load, but how do I add the image, js, and css folders into the iFrame?</p>
  
  <p>Here is what I have so far...</p>
  
  <pre><code>&lt;div id="jszip_utils"&gt;&lt;/div&gt;
  &lt;iframe id="iframe"&gt;&lt;/iframe&gt;
  &lt;script type="text/javascript"&gt;
      function showError(elt, err) {
          elt.innerHTML = "&lt;p class='alert alert-danger'&gt;" + err + "&lt;/p&gt;";
      }
      function showContent(elt, content) {
          elt.innerHTML = "&lt;p class='alert alert-success'&gt;loaded !&lt;br/&gt;" +
            "Content = " + content + "&lt;/p&gt;";
      }
      var htmltext = JSZipUtils.getBinaryContent("/zip/myWebsite.zip", function (err, data) {
          var elt = document.getElementById('jszip_utils');
          if (err) {
              showError(elt, err);
              return;
          }
          try {
              JSZip.loadAsync(data)
                  .then(function (zip) {
                      for(var name in zip.files) {
                          if (name.substring(name.lastIndexOf('.') + 1) === "html") {
                              return zip.file(name).async("string");
                          }
                      }
                      return zip.file("").async("string");
                  })
                  .then(function success(text) {
                      $('#iframe').contents().find('html').html(text);
                      showContent(elt, text);
                  }, function error(e) {
                      showError(elt, e);
                  });
          } catch(e) {
              showError(elt, e);
          }
      });
  &lt;/script&gt;
  </code></pre>
  
  <p>This gets the html, but the js css and image files are not showing up. I believe I need to do some sort of fake routing, but I'm not sure how I would be able to do that. Thanks for your help.</p>