From 3297ec0c879241e0c364197495aa98d4794e01cf Mon Sep 17 00:00:00 2001 From: Dani Palou Date: Thu, 4 Jun 2020 12:04:11 +0200 Subject: [PATCH] MOBILE-3413 h5p: Fix h5p iframe not visible in offline --- src/components/iframe/iframe.ts | 20 ++++++++++---------- src/providers/utils/iframe.ts | 2 +- 2 files changed, 11 insertions(+), 11 deletions(-) diff --git a/src/components/iframe/iframe.ts b/src/components/iframe/iframe.ts index c4969b4f4..dff2fd024 100644 --- a/src/components/iframe/iframe.ts +++ b/src/components/iframe/iframe.ts @@ -75,17 +75,17 @@ export class CoreIframeComponent implements OnInit, OnChanges { const navCtrl = this.svComponent ? this.svComponent.getMasterNav() : this.navCtrl; this.iframeUtils.treatFrame(iframe, false, navCtrl); + iframe.addEventListener('load', () => { + this.loading = false; + this.loaded.emit(iframe); // Notify iframe was loaded. + }); + + iframe.addEventListener('error', () => { + this.loading = false; + this.domUtils.showErrorModal('core.errorloadingcontent', true); + }); + if (this.loading) { - iframe.addEventListener('load', () => { - this.loading = false; - this.loaded.emit(iframe); // Notify iframe was loaded. - }); - - iframe.addEventListener('error', () => { - this.loading = false; - this.domUtils.showErrorModal('core.errorloadingcontent', true); - }); - setTimeout(() => { this.loading = false; }, this.IFRAME_TIMEOUT); diff --git a/src/providers/utils/iframe.ts b/src/providers/utils/iframe.ts index df872eb49..551606ead 100644 --- a/src/providers/utils/iframe.ts +++ b/src/providers/utils/iframe.ts @@ -55,7 +55,7 @@ export class CoreIframeUtilsProvider { checkOnlineFrameInOffline(element: any, isSubframe?: boolean): boolean { const src = element.src || element.data; - if (src && !this.urlUtils.isLocalFileUrl(src) && !this.appProvider.isOnline()) { + if (src && src != 'about:blank' && !this.urlUtils.isLocalFileUrl(src) && !this.appProvider.isOnline()) { if (element.classList.contains('core-iframe-offline-disabled')) { // Iframe already hidden, stop. return true;