1๏ธโฃ Microsoft Edge ๋ง์ดํฌ๋ก์ํํธ ์ฃ์ง
public void fileDown(HttpServletRequest request, HttpServletResponse response) {
String fileName = "ํ๊ธํ์ผ๋ช
";
// GET ๋ธ๋ผ์ฐ์ ์ ๋ณด
String header = request.getHeader("User-Agent");
// ์ธ์ฝ๋ฉ
if (header.contains("Edge")){
fileName = URLEncoder.encode(fileName, "UTF-8").replaceAll("\\+", "%20");
response.setHeader("Content-Disposition", "attachment;filename=\"" + fileName);
}
}
2๏ธโฃ MS IE ์ธํฐ๋ท์ต์คํ๋ก๋ฌ
public void fileDown(HttpServletRequest request, HttpServletResponse response) {
String fileName = "ํ๊ธํ์ผ๋ช
";
// GET ๋ธ๋ผ์ฐ์ ์ ๋ณด
String header = request.getHeader("User-Agent");
// ์ธ์ฝ๋ฉ
if (header.contains("MSIE") || header.contains("Trident")){
fileName = URLEncoder.encode(fileName, "UTF-8").replaceAll("\\+", "%20");
response.setHeader("Content-Disposition", "attachment;filename=\"" + fileName);
}
}
3๏ธโฃ Chrome ํฌ๋กฌ
public void fileDown(HttpServletRequest request, HttpServletResponse response) {
String fileName = "ํ๊ธํ์ผ๋ช
";
// GET ๋ธ๋ผ์ฐ์ ์ ๋ณด
String header = request.getHeader("User-Agent");
// ์ธ์ฝ๋ฉ
if (header.contains("Chrome")){
fileName = new String(fileName.getBytes("UTF-8"), "ISO-8859-1");
response.setHeader("Content-Disposition", "attachment; filename=\"" + fileName);
}
}
4๏ธโฃ Opera ์คํ๋ผ
public void fileDown(HttpServletRequest request, HttpServletResponse response) {
String fileName = "ํ๊ธํ์ผ๋ช
";
// GET ๋ธ๋ผ์ฐ์ ์ ๋ณด
String header = request.getHeader("User-Agent");
// ์ธ์ฝ๋ฉ
if (header.contains("Opera")){
fileName = new String(fileName.getBytes("UTF-8"), "ISO-8859-1");
response.setHeader("Content-Disposition", "attachment; filename=\"" + fileName);
}
}
5๏ธโฃ Firefox ํ์ด์ดํญ์ค
public void fileDown(HttpServletRequest request, HttpServletResponse response) {
String fileName = "ํ๊ธํ์ผ๋ช
";
// GET ๋ธ๋ผ์ฐ์ ์ ๋ณด
String header = request.getHeader("User-Agent");
// ์ธ์ฝ๋ฉ
if (header.contains("Firefox")){
fileName = new String(fileName.getBytes("UTF-8"), "ISO-8859-1");
response.setHeader("Content-Disposition", "attachment; filename=" + fileName);
}
}