我想強迫用戶下載從我的服務器一個js/PAC文件,我設置的nginx.conf如何強制使用nginx下載js文件?
server {
location ~ .*\.(pac|js)$ {
add_header Content-Disposition "attachment; filename=$request_filename";
}
}
或類似這樣的
server {
location /pacfile/ {
types {
application/octet-stream js;
}
}
}
但所有這些代碼此方法有效。爲什麼?
不知道,但現代瀏覽器支持A標籤上的下載屬性。試試:) – 2015-03-31 09:28:52