title: preview pdf with internet explorer before uploading it on the server
body: <p>I would like to display a pdf in the browser without storing it on the server (I got a lot of example with stored pdf but it's not what I want). The problem is that I'm not able to find a way to make it works in IE (current version on my desktop is IE11). It seems that IE doesn't like URL.createObjectUrl. I try compatibility mode "Edge" in my browser but nothing is displaying. Here's my code: </p>
  
  <pre><code>&lt;!DOCTYPE html&gt;   &lt;html lang="fr"&gt;
      &lt;head&gt;
          &lt;title&gt;JavaScript PDF Viewer Demo&lt;/title&gt;
          &lt;script type="text/javascript" src="http://ajax.googleapis.com/ajax/libs/jquery/1.7.2/jquery.min.js"&gt;&lt;/script&gt;
          &lt;script type="text/javascript"&gt;
              function PreviewImage() {
                  if(pdffile=document.getElementById("uploadPDF").files != undefined)
                  {
                      pdffile=document.getElementById("uploadPDF").files[0];
                  }
                  else
                  {
                      pdffile=document.getElementById("uploadPDF").value;
                  }
                  pdffile_url=URL.createObjectURL(pdffile);
                  $('#viewer').attr('src',pdffile_url);
              }
              function Deposer(){
                  alert("Déposé!");
              }
          &lt;/script&gt;
      &lt;/head&gt;
      &lt;body&gt;
          &lt;input id="uploadPDF" type="file" name="myPDF"/&gt;&amp;nbsp;
          &lt;input type="button" value="Visualiser" onclick="PreviewImage();" /&gt;        &lt;input type="button" value="Déposer" onclick="Deposer();" /&gt;
          &lt;div style="clear:both"&gt;
             &lt;iframe id="viewer" frameborder="0" scrolling="no" width="400" height="600"&gt;&lt;/iframe&gt;
          &lt;/div&gt;
      &lt;/body&gt; &lt;/html&gt;
  </code></pre>
  
  <p>I've an example who is working in IE but only for an image.</p>
  
  <pre><code>&lt;style type="text/css"&gt;
      #prevImage {
          border: 8px solid #ccc;
          width: 300px;
          height: 200px;
      }
  &lt;/style&gt;
  &lt;script type="text/javascript"&gt;
      function setImage(file) {
          if(document.all)
              document.getElementById('prevImage').src = file.value;
          else
              document.getElementById('prevImage').src = file.files.item(0).getAsDataURL();
          if(document.getElementById('prevImage').src.length &gt; 0)
              document.getElementById('prevImage').style.display = 'block';
      }
  &lt;/script&gt;
  &lt;form&gt;
      &lt;input type="file" name="myImage" onchange="setImage(this);" /&gt;
  &lt;/form&gt;
  &lt;img id="prevImage" style="display:none;" /&gt;
  </code></pre>
  
  <p>Does Somebody already make it work in IE? I can use Jquery but I can not install framework like nodejs (I know the Mozilla project PDF.js but it using nodejs).</p>