Why is Google Chrome getting the next warning?



  • Why does Google Chrome have a follow-up warning when you download the file from the server? Web-server - Apache

      Resource interpreted as Document but transferred with MIME type application/vnd.openxmlformats-officedocument.wordprocessingml.document
    

    PHP:

    $file = "uploads/demo.docx";
            //text/html; charset=UTF-8 - С этим заголовком предупреждений нету
            header ("Content-Type: application/msword, application/vnd.openxmlformats-officedocument.wordprocessingml.document; charset=UTF-8");
            header ("Accept-Ranges: bytes");
            header ("Content-Length: ".filesize($file));  
            header ("Content-Disposition: attachment; filename=demo.docx");  
            readfile($file);
    

    Even if we just show the way to the HTML file.

    <a href="http://server/uploads/demo.docx">Скачать</a>
    

    We'll get the same warning.



  • Try that. <a href="http://server/uploads/demo.docx" download>Скачать</a>

    It's a chrome problem. I remember the bug was connected to him.

    https://bugs.chromium.org/p/chromium/issues/detail?id=9891 - It's the roots. Guess we haven't fixed it yet.




Suggested Topics

  • 2
  • 2
  • 2
  • 2
  • 2
  • 2
  • 2
  • 2
  • 2
  • 2
  • 2
  • 2
  • 2
  • 2
  • 2