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/

guest271314
  • 1
  • 15
  • 104
  • 177
Michael Adair
  • 301
  • 3
  • 10
  • No actual question appears at OP? Can you post `base64` string at jsfiddle https://jsfiddle.net or plnkr https://plnkr.co? – guest271314 Aug 08 '17 at 03:11
  • Possible duplicate of [Pdf.js: rendering a pdf file using a base64 file source instead of url](https://stackoverflow.com/questions/12092633/pdf-js-rendering-a-pdf-file-using-a-base64-file-source-instead-of-url) – Obsidian Age Aug 08 '17 at 03:20
  • @guest271314 I added a jsfiddle. – Michael Adair Aug 08 '17 at 03:57
  • The `data URI` is malformed. How the `data URI` created? – guest271314 Aug 08 '17 at 04:01
  • 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,"` and it was just working until I changed my method for retrieval of the URI. – Michael Adair Aug 08 '17 at 04:12
  • @guest271314 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: https://groups.google.com/a/chromium.org/forum/#!topic/blink-dev/GbVcuwg_QjM – Michael Adair Aug 08 '17 at 04:41
  • @MichaelAdair So they have already began the madness https://groups.google.com/a/chromium.org/d/msg/blink-dev/GbVcuwg_QjM/b3wXkW6JAgAJ. Try using an ` – guest271314 Aug 08 '17 at 04:44
  • 1
    @guest271314 Thanks for your help... this changes a lot. – Michael Adair Aug 08 '17 at 04:46
  • 1
    @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 comment – guest271314 Aug 08 '17 at 04:47
  • 1
    @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 browsers – guest271314 Aug 08 '17 at 04:47

1 Answers1

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.

guest271314
  • 1
  • 15
  • 104
  • 177