Fix Firefox about:blank iframe braindeath

This commit is contained in:
Kristóf Tóth 2019-10-01 14:53:14 +02:00
parent ac1bb81162
commit 263701c499
1 changed files with 7 additions and 3 deletions

View File

@ -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);
}
}