Skip to content

Commit 44087ea

Browse files
committed
Another run at making modals work reliably in Chrome.
1 parent 824532f commit 44087ea

1 file changed

Lines changed: 12 additions & 3 deletions

File tree

js/tsugiscripts.js

Lines changed: 12 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -250,12 +250,21 @@ function showModalIframe(title, modalId, iframeId, spinnerUrl, refreshParentOnCl
250250
});
251251
}
252252

253-
// Attempt to fix Chrome issue
253+
// Attempt to fix Chrome issue (take 2)
254254
// https://stackoverflow.com/questions/7551912/jquery-force-set-src-attribute-for-iframe
255-
// If the enclosing modal contains an iframe, set the src after the modal is up
255+
// If the enclosing modal contains an iframe, set the src two seconds after the modal is up
256256
function showModalIframeUrl(title, modalId, iframeId, url, spinnerUrl, refreshParentOnClose) {
257257
showModalIframe(title, modalId, iframeId, spinnerUrl, refreshParentOnClose);
258-
console.log("Navigated "+url);
258+
if ( spinnerUrl ) {
259+
$('#'+iframeId).attr('src',spinnerUrl);
260+
} else {
261+
$('#'+iframeId).attr('src','about:blank');
262+
}
263+
setTimeout(finishModalIframeUrl, 2000, iframeId, url);
264+
}
265+
266+
function finishModalIframeUrl(iframeId, url) {
267+
console.log("Navigated "+iframeId+" to "+url);
259268
$('#'+iframeId).attr('src',url);
260269
}
261270

0 commit comments

Comments
 (0)