1
    previewAttachment = (event, file) => {
        event.preventDefault();
        let reader = new FileReader();
        reader.readAsDataURL(file);
        setTimeout(() => {
          window.open(reader.result,"_self");
        }, 500);
      };

The above code opens a file in Firefox and other Browsers, where as in google-chrome it downloads the file instead of opening it.

Mike Lischke
  • 48,925
  • 16
  • 119
  • 181
ikmo
  • 195
  • 1
  • 10

1 Answers1

0

In Chrome, after you have downloaded the file in the bottom of the Chrome window next to the downloaded file click the down arrow. This will show some options, select the "Always open files of this type". The next time previewAttachment code above is run, the file it will open rather than be downloaded.

This is a per-user setting and will only apply to the individual user, not to everyone.

DeclanMcD
  • 1,518
  • 4
  • 22
  • 41