这是一个下载服务器上文件的方法,在ie9 和其他浏览器都好用,但是ie8却不行,想问下大神们,我要怎样改能兼容ie8,或者有其他兼容ie8的下载方法
------解决方案--------------------
报什么错误呢。
------解决方案--------------------
IE8有没在工具栏底下弹出横幅提示下载之类的,点了就刷新了那种。
------解决方案--------------------
是不是 ie 的问题。ie8 重新下载测试呢。
------解决方案--------------------
应该是IE的问题。你选择工具——Internet选项——安全——可信站点——自定义级别——找到“下载”选项——都将“禁用”改为“启用”
------解决方案--------------------
我自己写的下载插件的代码,IE7-10都测试了,
public class LoadFile extends HttpServlet{
public void doGet(HttpServletRequest request,HttpServletResponse response)
throws IOException,ServletException{
OutputStream o=response.getOutputStream();
byte b[]=new byte[1024];
//the file to download.
File fileLoad=new File("D:\\download","MRVInst.exe");
//the dialogbox of download file.
response.setHeader("Content-disposition",
"attachment;filename="+"MRVInst.exe");
//set the MIME type.
response.setContentType("application/application/octet-stream bin");
//get the file length.
long fileLength=fileLoad.length();
String length=String.valueOf(fileLength);
response.setHeader("Content_Length",length);
//download the file.
FileInputStream in=new FileInputStream(fileLoad);
int n=0;
while((n=in.read(b))!=-1){
o.write(b,0,n);
}
}
public void doPost(HttpServletRequest request,HttpServletResponse response)
throws IOException,ServletException{
doGet(request,response);
}
}
------解决方案--------------------
java代码没有IE兼容性的问题,你换台电脑下载试试。
------解决方案--------------------
是不是可以修改IE内核呢?你查查