File won't download on iOS and iPad when using FileDownloader

Hi there!

I am developing a Vaadin (Version 7) Touchkit (Version 3) App that provides some streamed resource for download. I am using the FileDownloader as described
here
to do that.

Everything works fine on any Desktop (MAC & Windows) and Android phone, but it fails on iPhone and iPad - you click the link, see the “flash” of the link, but no dialog opens asking you with which app you would like to open the downloaded file. Basically nothing happens, not even an error in Log or something to hold on to.

So I tried to debug this issue:

  • Download file with Safari (cause safari is the browser that is used on iPad) and Desktop PC: Works!
  • Download file with Desktop MAC: Works!
  • Download file with Chrome + iPad/iPhone: Does not Work
  • Download file with Safari+ iPad/iPhone (thats the most desirable setup): Does not Work

Of course I tried this with a PDF file - so basically a file format that should be openable on iOS devices.

Has anybody any idea? I am quite puzzled acutally…

Hi,
did you find solution for this? I am facing same problem - file is downloaded on desktop, but nothing happens on iPad, I am using chrome and safari… I am using Vaadin 7, Touchkit 4

Bump

Using Vaadin 7.3.9 (no touch kit)

We have exactly the same behaviour.

  • On desktops (any browser) it works
  • On iOS devices (any browser) it does not work
    (- On Android devices (Chrome) it does work)

Any findings?

Best,
Saro

I have the same problem as developers above. I know it’s not a bug reporting place but it would be nice to have at least some workaround?

Hello,

Yes that’s annoying and I have to say that it’s a real disappointment for those who bought Touchkit addon. Even with this “pro” addon, there is no provided fix.

Nevertheless, you can still use the old way (deprecated but still working) with getPage()

        StreamResource.StreamSource source = new StreamResource.StreamSource() {
                
                private static final long serialVersionUID = 1L;
    
                public InputStream getStream() {
                   try {
                    return new BufferedInputStream(new FileInputStream(documentFile));
                } catch (FileNotFoundException e) {
                    // TODO Auto-generated catch block
                    e.printStackTrace();
                }
                   return null;
                }
            };
            
        StreamResource resource = new StreamResource(source, documentLabel);
        String ext = SystemManager.getExtension(documentLabel);
        String mimeType = MimeTypeUtils.getMimeTypeFromExtension(ext);
        logger.info("Found extension Mimetype : " + mimeType);
        
        resource.setMIMEType( mimeType );
        resource.setFilename(documentLabel);

        UI.getCurrent().getPage().open(resource, documentLabel, true);

It’s working on iOS devices, but be carefull it’s not working when you app is fullscreen (when you added it as a main screen icon)

Regards