-
-
Save Roy-Oto/d1564c72f1344d6cd72f939e74a1748c to your computer and use it in GitHub Desktop.
How to slow down the loading of iframes by adding Javascript
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<script> | |
function init() { | |
var vidDefer = document.getElementsByTagName('iframe'); | |
for (var i=0; i<vidDefer.length; i++) { | |
if(vidDefer[i].getAttribute('data-src')) { | |
vidDefer[i].setAttribute('src',vidDefer[i].getAttribute('data-src')); | |
} } } | |
window.onload = init; | |
</script> |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment