0

I'm loading an iframe by changing its src attribute and then registering a handler for its load event, i.e.

obj.iframe.attr('src', src); obj.iframe.load(function() { ... });

This works well as long as the iframe loads correctly. I'm wondering if there's an easy way using jquery to set a timeout for the iframe to load and detect errors if it doesn't load correctly.

1 Answer 1

1

You could put in the load function of the iframe a function which set a variable to true, and then use setInterval to check regularly if all is going ok. When the iframe is loaded correctly, you can use clearInterval to stop the checking operation.

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.