Skip to content

Commit 8ba36ca

Browse files
authored
[MOB-4840] Fix iframe height setting (#155)
* [MOB-4840] Fix iframe height setting * [MOB-4840] Add comment
1 parent 12ab73e commit 8ba36ca

File tree

1 file changed

+8
-1
lines changed

1 file changed

+8
-1
lines changed

src/inapp/utils.ts

Lines changed: 8 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -423,8 +423,15 @@ export const paintIFrame = (
423423
};
424424

425425
if (position !== 'Full') {
426+
const iframeHeight =
427+
iframe.contentWindow?.document?.body?.scrollHeight;
428+
/*
429+
For web in-app messages created with WYSIWYG editor,
430+
there is 8px margin all around the iframe document body.
431+
Add 16px to the iframe height to eliminate scrollbar.
432+
*/
426433
iframe.style.height =
427-
(iframe.contentWindow?.document?.body?.scrollHeight || 0) + 'px';
434+
((iframeHeight && iframeHeight + 16) || 0) + 'px';
428435
}
429436

430437
clearTimeout(timeout);

0 commit comments

Comments
 (0)