none
How to display embedded PDF in Internet Explorer 11 (IE11)?

    Question

  • Hi!

    I have a problem displaying PDF which is embedded into HTML page in Internet Explorer 10 and 11. I've tried different ways and didn't find a solution.

    This code works in IE10 and FireFox, but not in IE11:

    <body>
        <object id="pdf" type="application/pdf" width="600"
            height="250" data="Form1.pdf"></object>
    </body>

    This code works in FireFox, but doesn't work in IE10 and IE11:

    <body>
        <div id="placeholder">
        </div>
        <script type="text/javascript">
    
            $(function () {
                var obj = $("<object>", { id: "pdf", type: "application/pdf",
                    width: "600", height: "250" });
                obj.attr("data", "Form1.pdf");
                $("#placeholder").append(obj);
            });
    
        </script>
    </body>

    And this code works in IE10 and FireFox, but it still doesn't work in IE11:

    <body>
        <object id="template" type="application/pdf" width="600"
            height="250" style="display: none"></object>
        <div id="placeholder">
        </div>
        <script type="text/javascript">
    
            $(function () {
                var obj = $('#template').clone();
                obj.attr("data", "Form1.pdf");
                obj.show();
                $("#placeholder").append(obj);
            });
    
        </script>
    </body>

    So I'm wondering if there is any way to display embedded PDF in IE11? Or the only solution is to convert PDF to image on server side and send this image to client?

    P.S. Software I used for tests:

    1. Internet Explorer 11.0.9600.16476 on Windows 7 (Enhanced Protected Mode is disabled)

    2. Internet Explorer 10.0.9200.16746 on Windows Server 2012 R2

    3. Adobe Reader 11.0.5 (Protected Mode is disabled)


    Friday, December 27, 2013 11:24 PM

Answers

  • difference between my laptop and the virtual machine

    So is there a difference in Networking to the extent that one case is Intranet?  You could compare the two cases in more detail using ProcMon but the differences that you have already noted might make such a comparison much harder, e.g. to know where 64- versus 32- bit would be significant.

    Also, for cases like this I usually point out this ref:

    Understanding and Working in Protected Mode Internet Explorer

    http://msdn.microsoft.com/en-us/library/bb250462(VS.85).aspx

    E.g. the registry values it mentions could give you something to focus on in your ProcMon traces.

     

    Good luck



    Robert Aldwinckle
    ---

    Saturday, January 04, 2014 7:05 PM

All replies

  • In case that you are not having problems with your adobe plugin installation or a cross domain content linking, you should try:
    <iframe src="Form1.pdf"></iframe>
    p.s.:
    no scripting required.
    • Edited by aeneas dardanus Saturday, December 28, 2013 1:44 PM added ps
    • Proposed as answer by nanc79 Sunday, December 29, 2013 2:14 AM
    Saturday, December 28, 2013 1:43 PM
  • I've tried IFRAME, both "static" and dynamically created. Unfortunately, this was also didn't work. IE11 asked me to download the file. Anyway, thank you!
    Saturday, December 28, 2013 7:15 PM
  • Sorry to hear that;

    I've tested it on my IE11 running on win7 x64 and Firefox, with both local and remote pdf file locations and it worked as expected.

    I think you will be needing a fresh install of adobe pdf reader. !explorer must be closed during setup and a system restart might be required. Otherwise check with your web hosting service, it might be sending wrong headers to your client.

    Saturday, December 28, 2013 11:34 PM
  • au pire tu peux essayer Microsoft Words (fichier WEB) ou Java(TM) Platform SE binary (i586)
    Sunday, December 29, 2013 2:20 AM
  • I've tried to refresh Adobe Reader installation and the picture didn't change.

    Also, I've checked server response for the doc. It looks good (Content-Type: application/pdf).

    So I have no idea why it doesn't work! :)

    Monday, December 30, 2013 2:16 PM
  • Surprisingly, all code above plus IFRAMEs plus PDF.JS works in the IE11-on-Win7 virtual machine which I've just downloaded from the http://www.modern.ie/ web site. So, it looks like the problem is on my laptop (domain security policy etc.) So, I'm going to dig deeper into it.
    Monday, December 30, 2013 4:29 PM
  • Thank you, Max, I'll check Content-Disposition header also!
    Monday, December 30, 2013 4:29 PM
  • tools>Internet Options>security tab, click "reset all zones to default"

    tools>ActiveX filtering (turn it off)

    Tools>Manage addons>Show all addons.... locate your installed PDF Reader addons and ensure they are enabled.

    Adobe PDF Reader 10 and earlier have an option/setting to "Display PDF in the browser"

    web documents opened with the 'file:' protocol require a mark of the web to run Active Content.

    The latest IE11 update adds additional security for iframe hosted pdf documents.

    MSIE browsers don't support object hosted pdf or xps content. The common design pattern is a named or Id'd iframe.


    Rob^_^


    Thursday, January 02, 2014 12:27 AM
  • Internet Explorer security zones have default security settings. ActiveX filtering is turned off. And I suppose that "Display PDFs in browser" is turned on (I didn't find this option in the Preferences, but I've turned it on thru setup assistance).

    I even refreshed Adobe Reader installation to make sure that all registry keys/values are OK, but both OBJECT and IFRAME are not working as expected on my computer (but both ways work fine on virtual machine).

    For the OBJECT, IE loads DLL which contains Adobe Reader ActiveX into its 32-bit "content process". Both Fiddler and F12 Network tool show that ActiveX starts PDF downloading thru IE. But the screen contains placeholder frame or just remains blank. So something goes wrong during ActiveX initialization and I'm still unable to identify the reasons. In addition, this way worked fine with IE10.

    And for IFRAME, IE is just asking me to save PDF file.

    :)

    Thursday, January 02, 2014 4:25 PM
  • I'm still trying to understand, what is the difference between my laptop and the virtual machine. Settings look identical, but there are two major differences:

    1. Virtual machine runs 32-bit Windows, and I have 64-bit Windows on my laptop

    2. Virtual machine is not in the domain

    Thursday, January 02, 2014 4:26 PM
  • Run a WU on the VM.... there were updates for iframe security in the last IE patch.

    when posting code, please include your complete page markup or a publicly accessible link to a mashup. You did not mention what jquery version you are using.... (see bugs.jquery.com)


    Rob^_^

    Thursday, January 02, 2014 11:52 PM
  • There are no updates for IE11 available.

    I'm using jQuery 1.10.2.

    All code samples can be downloaded here:
    https://www.dropbox.com/s/rewicl8p9yb9daw/WebPdfViewer.zip

    Friday, January 03, 2014 3:06 PM
  • difference between my laptop and the virtual machine

    So is there a difference in Networking to the extent that one case is Intranet?  You could compare the two cases in more detail using ProcMon but the differences that you have already noted might make such a comparison much harder, e.g. to know where 64- versus 32- bit would be significant.

    Also, for cases like this I usually point out this ref:

    Understanding and Working in Protected Mode Internet Explorer

    http://msdn.microsoft.com/en-us/library/bb250462(VS.85).aspx

    E.g. the registry values it mentions could give you something to focus on in your ProcMon traces.

     

    Good luck



    Robert Aldwinckle
    ---

    Saturday, January 04, 2014 7:05 PM