1

How can I detect an iframe finish event in angular4 mainly (angular 2+) ? I just have normal iframe like this:

<iframe [src]="..." onLoad=""></iframe>

i faced a problem that when i enter the page that include the iframe the onlaod function run directly (the src is not availbale) and it runs again when the src become available .

1

1 Answer 1

2

i make a condition on onload if(this.src) because i faced problem when i access the page that have the iframe onload run directly when src not available, and re run again when iframe loaded when src is available. I removed the loader when iframe is fully loaded . so this is my solution:

<ion-spinner id="loader"  color="primary"></ion-spinner>
<iframe [src]="url"
        onload="if(this.src) document.getElementById('loader').style.display = 'none'"></iframe>

thank you. hope it help someone

Sign up to request clarification or add additional context in comments.

Comments

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.