Skip to content
Open
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
11 changes: 10 additions & 1 deletion js/resizeIframe.js
Original file line number Diff line number Diff line change
Expand Up @@ -22,6 +22,12 @@ export function createResizeIframe(site, frameId, debounceTime) {
// Trim leading slashes from frame ID
frameId = frameId.replace(/^\/+/, "");

// Did the last call to resize() actually succeed?
var delivered = false;
resizer.addEventListener("load", function () {
if (resizer.src !== "about:blank") delivered = true;
});

var resize = function (height) {
if (height == null) {
// Measure from the top of the document to the iframe container to get the document height
Expand All @@ -38,7 +44,10 @@ export function createResizeIframe(site, frameId, debounceTime) {
height +
"/" +
frameId;
if (resizer.src !== newResizerSrc) {

// Reload if the target changed or if the last change failed (in which case resizer.src is set to a failed URL that doesn't represent the current height)
if (resizer.src !== newResizerSrc || !delivered) {
delivered = false;
resizer.src = "about:blank";
setTimeout(function () {
resizer.src = newResizerSrc;
Expand Down
Loading