Embedded PDF sometimes not loading

NimrodYanai
NimrodYanai

This seems to be completely random.

Not sure what's causing it.

Sometimes, when I load a page with embedded PDFs, they iframe does not load.

See for example: Books | Baldur's Gate | Obsidian Portal

Not sure if it will work for you or not since it seems to happen at random.

Comments

  • vadercomplex
    vadercomplex
    Posts: 70

    Thank you for bringing this to our attention @NimrodYanai! We apologize for the delay, I'll have the team take a look at it asap. 

    Obsidian Portal Support Druid | [email protected]

  • thaen
    thaen
    Posts: 1,081 edited April 17

    @NimrodYanai, thanks for bringing this up! Keryth has pointed it out before, but it was so intermittent that I couldn't get it to repeat consistently to figure out what was going on. Your page had enough iframes on it that it repeated consistently.

    From what I can tell, this seems to be coming from Google's side of things. The iframe is just loading a url, so it shouldn't have any issues. But intermittently it does.

    I added some code to automatically reload a given iframe if it hasn't loaded after 10 seconds. Your page still takes a while to fully load with the new code, but it does get there eventually.

    I don't feel totally confident in this solution, so I may end up changing it later, but we'll try this for now and see how it goes.

    Let us know if you see any issues.
    Post edited by thaen on

    Obsidian Portal Developer

  • thaen
    thaen
    Posts: 1,081

    @NimrodYanai, I made a further change and now the page loads more consistently and faster.

    The main problem is that previously, when a PDF was embedded, the system would route the PDF's url to the Google Docs PDF Viewer.

    So, if your PDF url is:

    https://db4sgowjqfwig.cloudfront.net/campaigns/267666/assets/1370922/Domains_of_Dread.pdf?1701378757

    Then the system would create this url from that, and this url would be the iframe url:

    https://drive.google.com/viewerng/viewer?url=https://db4sgowjqfwig.cloudfront.net/campaigns/267666/assets/1370922/Domains_of_Dread.pdf?1701378757&embedded=true

    That would then return the PDF in the Google Docs PDF Viewer, and show it in the iframe.

    The change I made is to just use the browser's native PDF viewer, and to leave out the Google Docs PDF Viewer because sometimes, the Google Docs PDF Viewer wasn't responding, or would take a long time to respond, and so the iframe would never get loaded.

    If members want to keep using the Google Docs PDF Viewer, then they can embed the url with the Google Docs PDF Viewer already on it, like in the url above.

    In the Chrome browser, the native/default PDF viewer has a toolbar at the top (as opposed to at the bottom like the Google Docs PDF Viewer). If you want to hide that toolbar, then on your embedded url, add "&#toolbar=0" like this:

    https://db4sgowjqfwig.cloudfront.net/campaigns/267666/assets/1370922/Domains_of_Dread.pdf?1701378757&#toolbar=0

    Let us know if you see any issues.

    Obsidian Portal Developer

  • GamingMegaverse
    GamingMegaverse
    Posts: 3,001

    Love the support!!

    Just trying to help out.

  • NimrodYanai
    NimrodYanai
    Posts: 105

    Thank you!

    However, it seems this is still going on.

    The stranger thing is that it seems to work for some iframes and not others. I just checked the page, and some papers were loaded and some were not. That's just strange.

  • vadercomplex
    vadercomplex
    Posts: 70

    Hi @Nimrodyanai! I'll let @Thaen know. :) 

    Obsidian Portal Support Druid | [email protected]

  • thaen
    thaen
    Posts: 1,081

    @NimrodYanai, thanks for noting it's still going on for you.

    Can you post a screenshot?

    I opened your Books page from above, and the iframes all loaded eventually for me (they do take a little time to download), so I need details to dig in more.

    Obsidian Portal Developer

Sign In or Register to comment.

April 2024
Season of Strife

Read the feature post on the blog
Return to Obsidian Portal

Howdy, Stranger!

It looks like you're new here. If you want to get involved, click one of these buttons!

Discussions