From 263701c49950c787200b27eb4c10ba6032ca52bb Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Krist=C3=B3f=20T=C3=B3th?= Date: Tue, 1 Oct 2019 14:53:14 +0200 Subject: [PATCH] Fix Firefox about:blank iframe braindeath --- src/app/dashboard/dashboard.component.ts | 10 +++++++--- 1 file changed, 7 insertions(+), 3 deletions(-) diff --git a/src/app/dashboard/dashboard.component.ts b/src/app/dashboard/dashboard.component.ts index 3faf602..b46a042 100644 --- a/src/app/dashboard/dashboard.component.ts +++ b/src/app/dashboard/dashboard.component.ts @@ -141,9 +141,13 @@ export class DashboardComponent implements OnInit, OnDestroy { iframeLoad() { if (this.webiframe && this.iframeUrl.value) { - const href = this.webiframe.nativeElement.contentWindow.frames.location.href; - const niceURL = href.match(/.*?\/\/.*?(\/.*)/)[1]; - this.actualIframeUrl = niceURL; + // This hack deals with Firefox iframes having a valid src, + // but 'about:blank' contentWindow on (load) events + setTimeout(() => { + const href = this.webiframe.nativeElement.contentWindow.frames.location.href; + const niceURL = href.match(/.*?\/\/.*?(\/.*)/)[1]; + this.actualIframeUrl = niceURL; + }, 0); } }