下載文件方法:
window.location.href='http://www.baidu.com/down/downFile.txt?name=資源文件';
這種情況下載時:文件名資源文件會中文亂碼,解決辦法:encodeURI(fileUrl, "utf-8");
var newFileUrl=encodeURI('http://www.baidu.com/down/downFile.txt?name=資源文件', "utf-8");
window.location.href=newFileUrl;