Base64 PDF in new tab shows Blank Page before Refresh
Asked Answered
T

1

15

The title says it all really... I have a base64 pdf string which I append to: data:application/pdf;base64,

The pdf is brought into a new tab using a link in my webpage. A blank page will initially show up, but then I refresh the page and it displays perfectly.

This issue only began once I changed my NodeJS code for retreiving the PDF, before it was retreiving the PDF with the https module but now I am using request.

https://jsfiddle.net/o7upp4d8/

Tanning answered 8/8, 2017 at 3:7 Comment(10)
No actual question appears at OP? Can you post base64 string at jsfiddle jsfiddle.net or plnkr plnkr.co?Candiscandle
Possible duplicate of Pdf.js: rendering a pdf file using a base64 file source instead of urlKuban
@Candiscandle I added a jsfiddle.Tanning
The data URI is malformed. How the data URI created?Candiscandle
Well I get the data URI from the USPS Webtools API. Then I throw it straight into the webpage in a link like so: href="data:application/pdf;base64,<?php echo $label; ?>" and it was just working until I changed my method for retrieval of the URI.Tanning
@Candiscandle I just checked the console on that link and found this: Not allowed to navigate top frame to data URL, that then lead me here: groups.google.com/a/chromium.org/forum/#!topic/blink-dev/…Tanning
@MichaelAdair So they have already began the madness groups.google.com/a/chromium.org/d/msg/blink-dev/GbVcuwg_QjM/…. Try using an <iframe> to render the .pdf see #42107084Candiscandle
@Candiscandle Thanks for your help... this changes a lot.Tanning
@ObsidianAge No, the present Question is not a duplicate of the linked Question. It is a new "feature" of browser behaviour, see link at previous commentCandiscandle
@MichaelAdair Yes, it does change the landscape. At this point probably time to build a version of chromium without the "feature", though if you read the thread it appears that there is push to implement the "feature" at each of the browsersCandiscandle
C
8

There is a current push to disallow new windows to have the ability to navigate to a data URL Intent to Deprecate and Remove: Top-frame navigations to data URLs. The "feature" is apparently already being implemented.

There was some objection raised to the idea, but apparently not enough; at least not yet.

Candiscandle answered 8/8, 2017 at 4:53 Comment(0)

© 2022 - 2024 — McMap. All rights reserved.