title: white label error when i generate pdf
body: <p>I use spring boot and I use this code to generate pdf document.</p>
  
  <pre><code>@GetMapping(value = "/members/{memberId}/contract/{contractId}/generalcontracts", produces = "application/pdf")
  public ResponseEntity&lt;byte[]&gt; getMemberContract(@PathVariable("memberId") Long memberId, @PathVariable("contractId") Long contractId) throws IOException {
      byte[] content = reportService.generateMemberContractReport(contractId);
      return prepareReport(content);
  }
  
  private ResponseEntity&lt;byte[]&gt; prepareReport(byte[] content) throws IOException {
      HttpHeaders headers = new HttpHeaders();
      headers.setContentType(MediaType.parseMediaType("application/pdf"));
      String filename = "report.pdf";
      headers.setContentDispositionFormData(filename, filename);
      headers.setCacheControl("must-revalidate, post-check=0, pre-check=0");
      ResponseEntity&lt;byte[]&gt; response = new ResponseEntity&lt;&gt;(content, headers, HttpStatus.OK);
      return response;
  }
  </code></pre>
  
  <p>In js, I do</p>
  
  <pre><code>&lt;button id="memberPrintReport" type="button"  class="btn btn-primary"&gt;Imprimer&lt;/button&gt;
  
  $("#memberPrintReport").on('click', function (e) {
      tryit(getHostName() + "/members/" + memberId + "/contract/" + contractId + "/generalcontracts");
  }    
  
  function tryit(urlServer) {
      var win = window.open('_blank');
      downloadFile(urlServer, function (blob) {
          var url = URL.createObjectURL(blob);
          win.location = url;
      });
  }
  </code></pre>
  
  <p>A new tab open, I see during a few second a white label error and after I see the pdf.</p>
  
  <p>I don't understand why I get during a few instant this white label error</p>
  
  <p>Image of the white label error
  <a href="https://imagebin.ca/v/3Wnqxfpq1yR6" rel="nofollow noreferrer">https://imagebin.ca/v/3Wnqxfpq1yR6</a></p>
  
  <p>edit:</p>
  
  <pre><code>function downloadFile(url, success) {
      var xhr = new XMLHttpRequest();
      xhr.open('GET', url, true);
      xhr.setRequestHeader("Authorization", "Basic " + $.cookie('authorization'));
      xhr.responseType = "blob";
      xhr.onreadystatechange = function () {
          if (xhr.readyState == 4) {
              if (success)
                  success(xhr.response);
          }
      };
      xhr.send(null);
  }
  </code></pre>
  
  <p>Edit</p>
  
  <p>that work with chrome, but not with firefox</p>
  
  <pre><code>function tryit(urlServer) {
    downloadFile(urlServer, function (blob) {
      var url = URL.createObjectURL(blob);
       window.open(url, '_blank');
  
    });
  }
  </code></pre>