From ff993eb483ef6cf28ed7c2face235c53e00bbd71 Mon Sep 17 00:00:00 2001 From: Aleksander Machniak Date: Wed, 16 Oct 2013 09:10:47 +0200 Subject: Fix iframe onload for upload errors handling (#1489379) --- program/js/app.js | 22 ++++++++++------------ 1 file changed, 10 insertions(+), 12 deletions(-) (limited to 'program') diff --git a/program/js/app.js b/program/js/app.js index 7fbab8003..6dfe102b3 100644 --- a/program/js/app.js +++ b/program/js/app.js @@ -6534,7 +6534,7 @@ function rcube_webmail() // post the given form to a hidden iframe this.async_upload_form = function(form, action, onload) { - var ts = new Date().getTime(), + var frame, ts = new Date().getTime(), frame_name = 'rcmupload'+ts; // upload progress support @@ -6553,21 +6553,19 @@ function rcube_webmail() // have to do it this way for IE // otherwise the form will be posted to a new window if (document.all) { - var html = ''; - document.body.insertAdjacentHTML('BeforeEnd', html); + document.body.insertAdjacentHTML('BeforeEnd', ''); + frame = $('iframe[name="'+frame_name+'"]'); } - else { // for standards-compilant browsers - var frame = document.createElement('iframe'); - frame.name = frame_name; - frame.style.border = 'none'; - frame.style.width = 0; - frame.style.height = 0; - frame.style.visibility = 'hidden'; - document.body.appendChild(frame); + // for standards-compliant browsers + else { + frame = $('