Support » Fixing WordPress » The embedded PDF file does not appear in all browsers.

  • Resolved michalrama

    (@michalrama)


    Hello,

    I uploaded a PDF file and pasted it into the page. I enabled the “Show inline embed” option. The web browser can display the PDF file (eg locally from disk), but here it has a problem. I tried to use these browsers – Opera GX, Opera, Chrome, Edge, Firefox.

    Of these browsers, only Firefox will display it, others will only display a white space. I tried to use the plugin for this purpose, but it didn’t help. Obviously it depends purely on browser support.

    However, can it be done in another way to make it work in all browsers, please?

    Thank you

    The page I need help with: [log in to see the link]

Viewing 8 replies - 1 through 8 (of 8 total)
  • The Embed PDF Viewer plugin uses the object tag to display the PDF.

    https://caniuse.com/mdn-html_elements_object

    Thread Starter michalrama

    (@michalrama)

    @afragen

    This element is used by WordPress itself and Opera, Chrome and Edge have a version that supports it. Obviously it depends on something else.

    @michalrama I’m on a Mac and Embed PDF Viewer does work up with Safari, Chrome, and Firefox. I don’t have any of the other browsers for testing. Sorry.

    I’m not familiar with the “Show inline embed” option.

    Thread Starter michalrama

    (@michalrama)

    @afragen

    I’ve figured it out. It never occurred to me to use the Console.

    www.handpro.cz/:1 Mixed Content: The page at 'https://www.handpro.cz/index.php/nase-produkty-a-sluzby/' was loaded over HTTPS, but requested an insecure plugin resource 'http://www.handpro.cz/wp-content/uploads/2021/09/HandPRO_produkty_a_sluzby_komplet.pdf'. This request has been blocked; the content must be served over HTTPS.
    www.handpro.cz/:1 Mixed Content: The page at 'https://www.handpro.cz/index.php/nase-produkty-a-sluzby/' was loaded over HTTPS, but requested an insecure plugin resource 'http://www.handpro.cz/wp-content/uploads/2021/09/HandPRO_produkty_a_sluzby_komplet.pdf'. This request has been blocked; the content must be served over HTTPS.

    The website itself uses HTTPS, and any URL (even with HTTP) is automatically redirected to HTTPS. However, the URLs to the files are always with HTTP and cannot be changed (that is, the URL cannot be edited for the uploaded file).

    Is it possible, please, to modify it so that the files use HTTPS, or to solve it in another way?

    UPDATE

    So when I insert a file, it can be edited as HTML.

    <div class="wp-block-file"><object class="wp-block-file__embed" data="http://www.handpro.cz/wp-content/uploads/2021/09/HandPRO_produkty_a_sluzby_komplet.pdf" type="application/pdf" style="width:100%;height:600px" aria-label="Embed of HandPRO_produkty_a_sluzby_komplet."></object><a href="http://www.handpro.cz/wp-content/uploads/2021/09/HandPRO_produkty_a_sluzby_komplet.pdf">HandPRO_produkty_a_sluzby_komplet</a><a href="http://www.handpro.cz/wp-content/uploads/2021/09/HandPRO_produkty_a_sluzby_komplet.pdf" class="wp-block-file__button" download>Stáhnout</a></div>

    However, when I rewrite everything there on HTTPS, it does not appear and it also reports an error that it contains unexpected or invalid content. And if I fix it, HTTPS will change back to HTTP.

    The plugin doesn’t modify the URI of the PDF. As you’ve said “the URI to the file is always http”, I can’t fix that. It something you’ll need to fix on your end with a rewrite or something.

    It would seem the simplest solution would be to serve everything in the site via https.

    Thread Starter michalrama

    (@michalrama)

    @afragen

    It would seem the simplest solution would be to serve everything in the site via https.

    It occurred to me too, but how do I set it up? In WordPress or on Webhosting?

    I think that needs to be set up in hosting.

    Thread Starter michalrama

    (@michalrama)

    @afragen

    It is set on the web hosting for this domain

    Redirection to HTTPS: Enabled and deals with mixed content

    So it should work, but in this case, it obviously doesn’t help. However, it occurred to me that viewing the PDF using another element might solve the problem. But is there another way than using the object element, please?

    UPDATE
    So I’ve figured it out, it’s necessary to display it using the iframe element – link.

    Thank you anyway

Viewing 8 replies - 1 through 8 (of 8 total)
  • You must be logged in to reply to this topic.