diff --git a/src/core/directives/format-text.ts b/src/core/directives/format-text.ts index a790499db..8ac3ea96f 100644 --- a/src/core/directives/format-text.ts +++ b/src/core/directives/format-text.ts @@ -876,7 +876,7 @@ export class CoreFormatTextDirective implements OnChanges, OnDestroy, AsyncDirec if (iframe.contentDocument) { const css = document.createElement('style'); css.setAttribute('type', 'text/css'); - css.innerHTML = 'iframe {width: 100%;height: 100%;}'; + css.innerHTML = 'iframe {width: 100%;height: 100%;position:absolute;top:0; left:0;}'; iframe.contentDocument.head.appendChild(css); } }); diff --git a/src/core/services/utils/iframe.ts b/src/core/services/utils/iframe.ts index 6837b2625..93e9a0933 100644 --- a/src/core/services/utils/iframe.ts +++ b/src/core/services/utils/iframe.ts @@ -344,7 +344,8 @@ export class CoreIframeUtilsProvider { element.classList.add('core-loading'); - const treatElement = (sendResizeEvent: boolean = false) => { + const treatElement = (sendResizeEvent = false) => { + this.checkOnlineFrameInOffline(element, isSubframe); const { window, document } = this.getContentWindowAndDocument(element); @@ -361,10 +362,12 @@ export class CoreIframeUtilsProvider { // Iframe content has been loaded. // Send a resize events to the iframe so it calculates the right size if needed. - if (window && sendResizeEvent) { + if (sendResizeEvent) { element.classList.remove('core-loading'); - setTimeout(() => window.dispatchEvent && window.dispatchEvent(new Event('resize')), 1000); + if (window) { + setTimeout(() => window.dispatchEvent && window.dispatchEvent(new Event('resize')), 1000); + } } };