MOBILE-3413 h5p: Fix h5p iframe not visible in offline

main
Dani Palou 2020-06-04 12:04:11 +02:00
parent bea4e501b4
commit 3297ec0c87
2 changed files with 11 additions and 11 deletions

View File

@ -75,17 +75,17 @@ export class CoreIframeComponent implements OnInit, OnChanges {
const navCtrl = this.svComponent ? this.svComponent.getMasterNav() : this.navCtrl; const navCtrl = this.svComponent ? this.svComponent.getMasterNav() : this.navCtrl;
this.iframeUtils.treatFrame(iframe, false, 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) { 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(() => { setTimeout(() => {
this.loading = false; this.loading = false;
}, this.IFRAME_TIMEOUT); }, this.IFRAME_TIMEOUT);

View File

@ -55,7 +55,7 @@ export class CoreIframeUtilsProvider {
checkOnlineFrameInOffline(element: any, isSubframe?: boolean): boolean { checkOnlineFrameInOffline(element: any, isSubframe?: boolean): boolean {
const src = element.src || element.data; 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')) { if (element.classList.contains('core-iframe-offline-disabled')) {
// Iframe already hidden, stop. // Iframe already hidden, stop.
return true; return true;