Added a workaround for sporadically (not fully reproducible) empty modal iframes in Chrome based Browsers (references #2480 and #2421)

This commit is contained in:
Bernd Bestel
2024-02-24 15:36:43 +01:00
parent ac26c5510b
commit 11ac985e57

View File

@@ -554,9 +554,27 @@ ResizeResponsiveEmbeds = function(fillEntireViewport = false)
} }
$("embed.embed-responsive").attr("height", maxHeight.toString() + "px"); $("embed.embed-responsive").attr("height", maxHeight.toString() + "px");
ResizeIframes();
}
ResizeIframes = function()
{
$("iframe.embed-responsive").each(function() $("iframe.embed-responsive").each(function()
{ {
$(this).attr("height", $(this)[0].contentWindow.document.body.scrollHeight.toString() + "px"); var desiredHeight = $(this)[0].contentWindow.document.body.scrollHeight;
if (desiredHeight == 0)
{
// The corresponding frame should be loaded after the "onload" event fired,
// this seems to be sometimes (not really reproducible) not the case in Chrome based Browsers...
// => So if that happens, just try this again later
setTimeout(function()
{
ResizeIframes();
}, 200);
}
else
{
$(this).attr("height", desiredHeight.toString() + "px");
}
}); });
} }
$(window).on('resize', function() $(window).on('resize', function()