This problem is often encountered. It is also common to handle the default link behavior of JPG, PDF, SVG, and other types of files.
Whether the file is opened or downloaded depends on the Content-Type and content-disposition in the HTTP header,
Although the default type of the HTTP protocol for unknown media is octet-stream, the MIME standard default type is text/plain.
Therefore, the specific behavior depends on the application server's implementation of the HTTP protocol.
I encountered the default IMPLEMENTATION OF THE nginx server.
When nginx does not set default_type, the APK file is treated as the text/plain type, which causes the APK file to be opened rather than downloaded as a text file.
To download the file, use the nginx configuration command default_type:
Default_type application/octet-stream;
Based on the HTTP protocol
Http://www.w3.org/Protocols/HTTP/1.0/draft-ietf-http-spec.html
The octet-stream8 BIT data stream represents an unknown media type, which is tested to be downloaded in FF/IE8 by default.
Of course, you can also modify the default page behavior by modifying the header Through the application.
Reference link:
1. http://wiki.nginx.org/HttpCoreModule#types
2. http://mattryall.net/blog/2008/03/default-content-type
3. http://www.vbulletin.com/forum/forum/general/chit-chat/72776-http-headers-to-force-file-to-download-rather-than-auto-open
4. http://www.boutell.com/newfaq/creating/forcedownload.html
The third link above explains in detail the use of content-disposition, where attachment is download, inline is open in the browser
By iefreer