在浏览器里,下载MP3或者wav文件,下载后会自动打开播放器播放。
要禁用浏览器自动默认文件,解决方法
在web服务器中这样实现:
改变默认http头
比如mp3 文件,就不能用 Content-Type: audio/mpeg
HTTP/1.0 200 OK\r\n
Pragma: no-cache\r\n
Cache-Control: no-cache\r\n
Expires: 0\r\n
Connection:close\r\n
Accept-Ranges: bytes\r\n
Content-Type: application/octet-stream\r\n
Content-Disposition:attachment; filename=\"1.mp3\"\r\n
Content-Length:1000\r\n\r\n
......文件中实际内容--------