Trang web này sẽ có chức năng hạn chế trong khi chúng tôi trải qua bảo trì để cải thiện trải nghiệm của bạn. Nếu một bài viết không giải quyết được vấn đề của bạn và bạn muốn đặt câu hỏi, chúng tôi có cộng đồng hỗ trợ của chúng tôi đang chờ để giúp bạn tại @FirefoxSupport trên Twitter và /r/firefox trên Reddit.

Tìm kiếm hỗ trợ

Tránh các lừa đảo về hỗ trợ. Chúng tôi sẽ không bao giờ yêu cầu bạn gọi hoặc nhắn tin đến số điện thoại hoặc chia sẻ thông tin cá nhân. Vui lòng báo cáo hoạt động đáng ngờ bằng cách sử dụng tùy chọn "Báo cáo lạm dụng".

Tìm hiểu thêm

Firefox is opening a blank dialog box for open with or save as whereas ut is running properly on IE.

  • 2 trả lời
  • 4 gặp vấn đề này
  • 1 lượt xem
  • Trả lời mới nhất được viết bởi mayank_agarwal

more options

0 down vote favorite


Hi, I am unable to open a msword file using response.header in firefox. When I click on a link in mozilla it just shows me a popup but without any details, it shows me the open or save option but it doesnt show any details of the file. on the other hand it works properly in IE. Please help, I am showing my code below.

List<UserRegistrationDetail> registration = dao
                    .executeQuery("from org.mihgh.domain.UserRegistrationDetail reg"
                            + " where reg.id=" + userid);


            byte[] fileDetailsArray = registration.get(0).getNihBioSketchFile()
                    .getFileContent();
            String filename = registration.get(0).getNihBioSketchFile()
                    .getFileName();



            response.reset();
            response.setContentType("application/msword");
            response.setHeader("Content-Disposition", "attachment; filename=\""
                    + filename + "\";");
            response.setContentLength(fileDetailsArray.length+1000);
            response.setHeader("Pragma", "public");
            response.setHeader("Cache-Control", "cache");
            response.setHeader("Cache-Control", "must-revalidate");

            OutputStream opstream = response.getOutputStream();
            File file = new File(realPath+"temp.doc");
            file.createNewFile();
            FileUtils.writeByteArrayToFile(file, fileDetailsArray);


            FileInputStream fileInputStream = new FileInputStream(file);
            BufferedInputStream bis = new BufferedInputStream(fileInputStream);


            int count = 0;
            while((count = bis.read()) != -1)
            {
                opstream.write(count);
            }
            opstream.flush();
            opstream.close();
            bis.close();
            file.delete();
0 down vote favorite Hi, I am unable to open a msword file using response.header in firefox. When I click on a link in mozilla it just shows me a popup but without any details, it shows me the open or save option but it doesnt show any details of the file. on the other hand it works properly in IE. Please help, I am showing my code below. <pre><nowiki>List<UserRegistrationDetail> registration = dao .executeQuery("from org.mihgh.domain.UserRegistrationDetail reg" + " where reg.id=" + userid); byte[] fileDetailsArray = registration.get(0).getNihBioSketchFile() .getFileContent(); String filename = registration.get(0).getNihBioSketchFile() .getFileName(); response.reset(); response.setContentType("application/msword"); response.setHeader("Content-Disposition", "attachment; filename=\"" + filename + "\";"); response.setContentLength(fileDetailsArray.length+1000); response.setHeader("Pragma", "public"); response.setHeader("Cache-Control", "cache"); response.setHeader("Cache-Control", "must-revalidate"); OutputStream opstream = response.getOutputStream(); File file = new File(realPath+"temp.doc"); file.createNewFile(); FileUtils.writeByteArrayToFile(file, fileDetailsArray); FileInputStream fileInputStream = new FileInputStream(file); BufferedInputStream bis = new BufferedInputStream(fileInputStream); int count = 0; while((count = bis.read()) != -1) { opstream.write(count); } opstream.flush(); opstream.close(); bis.close(); file.delete();</nowiki></pre>

Được chỉnh sửa bởi cor-el vào

Tất cả các câu trả lời (2)

more options

What happens if a similar document is served as static?

more options

I am still getting the same problem.