title: Downloading base64 pdf on Safari
body: <p>I have a POST call that returns a base64 PDF. When I call this endpoint I convert it to a Blob and then download it. This works fine in all browsers except for Safari.</p>
  
  <pre><code>openPdf = () =&gt; {
  
    const sendObj = {
      fakeValue: 'test'
    };
  
    axios.post('https://fakeendpoint.com/create-pdf', sendObj)                
      .then((res) =&gt; {
        const base64URL = res.data;
        const binary = atob(base64URL.replace(/\s/g, ''));
        const len = binary.length;
        const buffer = new ArrayBuffer(len);
        const view = new Uint8Array(buffer);
  
        for (let i = 0; i &lt; len; i += 1) {
          view[i] = binary.charCodeAt(i);
        }
  
        // create the blob object with content-type "application/pdf"
        const blob = new Blob([view], { type: 'application/pdf' });
        const url = URL.createObjectURL(blob);
  
        const a = document.createElement('a');
        document.body.appendChild(a);
        a.style = 'display: none';
        a.href = url;
        a.download = 'Test.pdf';
        a.target = '_blank';
        a.click();
    });
  }
  </code></pre>
  
  <p>How can I get this to work in Safari?</p>