yan
yan

Reputation: 169

How to close modal dialog when file download completed

I have a modal dialog which contain form and hidden iframe to which form is submitted. The result of submission is file to download. I need to close modal dialog as soon as download dialog is opened i.e. file is ready. I was trying to catch 'onreadystatechange' event of iframe, but after submit call changing state to 'complete' it does not trigger 'onreadystatechange' event.

Eventually, i use window.setInterval which monitoring readyState of iframe and close modal dialog when its state == 'complete'.

the solution that using window.setInterval seems not professional to me and I am looking for better solution, I saw solution with cookies but I can't use cookies in my application.

Any help will be appreciated!

Upvotes: 3

Views: 3435

Answers (2)

user10655999
user10655999

Reputation:

 function Close_Popup() {
        $(".modal-backdrop").remove();
        $('#div_Popup1').modal('hide');
        $(".modal-backdrop fade in").remove();
    }

Call this function on OnClientClick="Close_div_Popup1_Popup();"

Upvotes: 0

m0sa
m0sa

Reputation: 10940

There is nothing wrong or unprofessional in using window.setInterval().

Upvotes: 2

Related Questions