diff --git a/WebContent/js/custom.js b/WebContent/js/custom.js index e6bb511..c5e7c5f 100644 --- a/WebContent/js/custom.js +++ b/WebContent/js/custom.js @@ -36,6 +36,14 @@ // save the returnValue in options so that it is available in the callback function optns.returnValue = $frame[0].contentWindow.window.returnValue; optns.onClose(); + // Remove iframe from DOM so window.frames doesn't accumulate stale entries; + // without this, a second showModal call leaves frames[0] pointing to the first + // (closed) iframe, causing the previous returnValue to bleed into the next callback. + var $dialogEl = $frame.closest('.ui-dialog'); + setTimeout(function() { + $frame.remove(); + if ($dialogEl.length) $dialogEl.remove(); + }, 0); if(optns.option && optns.option.fullScreenPopup){ $('iframe[name=topFrame]',window.parent.document).css('display', 'block'); diff --git a/WebContent/jsp/js/custom.js b/WebContent/jsp/js/custom.js index 2cde935..5eda123 100644 --- a/WebContent/jsp/js/custom.js +++ b/WebContent/jsp/js/custom.js @@ -36,6 +36,14 @@ // save the returnValue in options so that it is available in the callback function optns.returnValue = $frame[0].contentWindow.window.returnValue; optns.onClose(); + // Remove iframe from DOM so window.frames doesn't accumulate stale entries; + // without this, a second showModal call leaves frames[0] pointing to the first + // (closed) iframe, causing the previous returnValue to bleed into the next callback. + var $dialogEl = $frame.closest('.ui-dialog'); + setTimeout(function() { + $frame.remove(); + if ($dialogEl.length) $dialogEl.remove(); + }, 0); if(optns.option && optns.option.fullScreenPopup){ $('iframe[name=topFrame]',window.parent.document).css('display', 'block');