0

Good morning!

I have a java servlet which receives a list of parameters and generates a PDF file for me.

Something like:

http://url/download/file?id=123&ext=pdf

When I access that URL within my browser window, the file is downloaded.

The problem is that I need to download the file in a hidden iframe, and notify the user when the download completes.

Downloading the file is easy:

var iframe = $('<iframe/>', {
                        src:   formURL+'&'+formData+'&docList='+inputDocList.val()
                    });
$('body').append(iframe);

Iframe is appended to the body and the download starts. I need to know when the download ends. I already tried using jquery's load event:

iframe.load(...)

but it wont trigger when my download finishes. I also tried inspecting the DOM of the iframe before and after the download completes, and it appears to be the same.

Is there a way to do this? I need a callback!

Thank you guys.

Fabio K
  • 1,297
  • 4
  • 13
  • 24

1 Answers1

0

I think you can do some callback from the iframe (after finish load) but it doesnt mean the download finished. This question looks like something you need to do. I also did some search and like said in the link i dont think there is a event for this, but you can see some work arounds.

Community
  • 1
  • 1
pecci
  • 540
  • 5
  • 17