Filesaver.js: Opening up in same Tab in Safari on iPhone

Created on 20 Jun 2017  路  5Comments  路  Source: eligrey/FileSaver.js

In Safari on my iPhone / iPad the File (PDF) does not open up in a new Window but in the same Window, so I have to navigate back to the Page where I came from.

It should open up in a new Tab as described.

_If you can't confirm this issue I can show you, but I don't want to publish the URL right here._

Most helpful comment

Having this issue with Angular 6 when using iOS 12 Safari.
Opens in the same window and pressing 'back' reloads our single page app entirely.
@eligrey can we re-open

All 5 comments

Yes I agree. File should be open in new tab.
iPhone 5 iOS 10.3.2

Here, we explicitly create another window and navigate to it. There's already some provision for this workaround on this module, but line https://github.com/eligrey/FileSaver.js/blob/master/FileSaver.js#L126 needs to exclude iOS.

Same issue with iOS 11.3. Opens in same window.

Anyone find a workaround to trigger a new window/tab?

Confirmed. I think this issue depends on Safari on iOS.
I've created 2 apps from react-boilerplate and CRA with the same implementation.

Import dependencies

import { saveAs } from 'file-saver';
import jsdocx from 'jsdocx';

and render a button

<button onClick={() => {
  const doc = new jsdocx.Document();
  doc
    .addParagraph()
    .addRun()
    .addText('Hello World!');
  doc.generate().then(content => {
    saveAs(content, 'test.docx');
  });
}}>
  Click me
</button>

When clicking the CRA button, Safari opens new tab and displays blob data.
But in react-boilerplate, Safari navigate to blob url. It's strange to me and I'm still investigating.

**Update: include live heroku
React boilerplate
Create react app

Having this issue with Angular 6 when using iOS 12 Safari.
Opens in the same window and pressing 'back' reloads our single page app entirely.
@eligrey can we re-open

Was this page helpful?
0 / 5 - 0 ratings