title: React js :I need to open file in chrome browser instead downloading.for ex: onclick docx,excel,pdf,zip file open in the recommended application
body: <pre><code>    previewAttachment = (event, file) =&gt; {
          event.preventDefault();
          let reader = new FileReader();
          reader.readAsDataURL(file);
          setTimeout(() =&gt; {
            window.open(reader.result,"_self");
          }, 500);
        };
  </code></pre>
  
  <p>The above code opens a file in Firefox and other Browsers, where as in <strong>google-chrome</strong> it downloads the file instead of opening it.</p>