firefoxとIEのダウンロードの違い
mimimaとかでファイルダウンロードをするとIEではダウンロードできるのに、firefoxでは画面に得体の知れない文字を残してダウンロードできないことがある。この原因を確認。firefoxでダウンロードするときの様子をキャプチャしてみるとヘッダがこうなっている。
POST /fetch.php HTTP/1.1
Host: www5.mimima.com
User-Agent: Mozilla/5.0 (Windows; U; Windows NT 5.1; ja; rv:1.8.1) Gecko/20061010 Firefox/2.0
Accept: text/xml,application/xml,application/xhtml+xml,text/html;q=0.9,text/plain;q=0.8,image/png,*/*;q=0.5
Accept-Language: ja,en-us;q=0.7,en;q=0.3
Accept-Encoding: gzip,deflate
Accept-Charset: Shift_JIS,utf-8;q=0.7,*;q=0.7
Keep-Alive: 300
Connection: keep-alive
Referer: http://www5.mimima.com/link.php?ref=xxxxxxxx
Content-Type: multipart/form-data; boundary=---------------------------41184676334
Content-Length: 145
-----------------------------41184676334
Content-Disposition: form-data; name="code"
xxxxxxxx
-----------------------------41184676334--
HTTP/1.1 200 OK
Date: Sat, 25 Nov 2006 09:50:54 GMT
Server: Apache/2.0.46 (Red Hat)
X-Powered-By: PHP/4.3.9
Last-Modified: Fri, 01 Jan 1971 00:00:00 GMT
Pragma: no-cache
Content-Encoding: none
Content-Disposition: inline; filename=xxxxxxxx.torrent
Content-length: 78990
Connection: close
Content-Type: torrent
何が問題かというとContent-Dispositionが"inline"になっているため。これだとブラウザに表示されてしまう。ダウンロードさせたいのであれば"attachment;"であるべき。ただ、inlineの後ろにファイル名がついているのはサーバ側の返事がおかしい。
ではなぜIEはダウンロードできるのか・・・?IEの実装が想定外の返事にはとりあえずダウンロードするようにしているから、と思われる。もしくは何も考えていないのか・・・?
| 固定リンク

コメント
If you are in not good state and have got no cash to get out from that, you will need to take the personal loans. Because it should help you definitely. I take commercial loan every year and feel myself good because of that.
投稿: HenriettaHart | 2012年5月21日 (月) 09時35分