Miqro
Miqro

Reputation: 477

How to delay loading of iframe?

I was just wondering, how I could delay iframe load by 5 seconds? I only know html and css so far, and don't have time, atleast this year to start javascript.

Anyway, for a website I'm working on, I need iframe to load after 5 seconds. Any help would be well appreciated.

Thank you!

Upvotes: 0

Views: 6848

Answers (1)

Natural Lam
Natural Lam

Reputation: 742

you will need to use Javascript, say in your html file:

<iframe id="myIframe"></iframe>

<script>
    window.setTimeout(function () {
        var iframe = document.getElementById('myIframe');
        iframe.setAttribute('src', 'http://...');
    }, 5000);    
</script>

Upvotes: 3

Related Questions