JSF streamed download on android device returns .htm file

后端 未结 2 1424
一整个雨季
一整个雨季 2021-01-21 05:39

I\'m currently facing a weird problem in my webpage on android devices.

What I want to do is to allow a user to download a pdf-file to his mobile device. Therefore I pro

2条回答
  •  鱼传尺愫
    2021-01-21 06:21

    had the same problem. I used the example code from primefaces.org for downloading a pdf with mobile devices. It was working fine "on my machine" but not on a iPad Safari or Android browsers. Problem was the content type in the Example-Controller provided in the showcase:

    file = new DefaultStreamedContent(stream, "image/jpg", "some.pdf");
    

    Which works only for images. Well, brain on mode:

    file = new DefaultStreamedContent(stream, "application/pdf", "some.pdf"); 
    

    and everything works fine now.

提交回复
热议问题