Compare commits

..
Author SHA1 Message Date
Kristóf Tóth 46fe26861c Fix Firefox iframe about:blank after load braindeath 2019-10-02 15:58:38 +02:00
+8 -6
View File
@@ -141,13 +141,15 @@ export class DashboardComponent implements OnInit, OnDestroy {
iframeLoad() { iframeLoad() {
if (this.webiframe && this.iframeUrl.value) { if (this.webiframe && this.iframeUrl.value) {
// This hack deals with Firefox iframes having a valid src, const href = this.webiframe.nativeElement.contentWindow.frames.location.href;
// but 'about:blank' contentWindow on (load) events console.log(href, this.webiframe.nativeElement.contentWindow);
setTimeout(() => { const match = href.match(/.*?\/\/.*?(\/.*)/);
const href = this.webiframe.nativeElement.contentWindow.frames.location.href; if (match !== null) {
const niceURL = href.match(/.*?\/\/.*?(\/.*)/)[1]; // iframes on Firefox can have an about:blank
// contentWindow after firing a (load) event
const niceURL = match[1];
this.actualIframeUrl = niceURL; this.actualIframeUrl = niceURL;
}, 0); }
} }
} }