How to make YouTube videos load faster on website

How to make YouTube videos load faster

Is your website load slower whenever you embedded YouTube video on it

So how to solve this for your website and make load faster than ever before

Just simple steps to follow

1 Get the embed code

<iframe width=”560″ height=”315″ src=”” frameborder=”0″ allowfullscreen></iframe>

2 Change Code Like Below

<iframe width=”560″ height=”315″ src=”” data-src=”//” frameborder=”0″ allowfullscreen></iframe>

3. Add Below Java script to bottom of page

function init() {
var vidDefer = document.getElementsByTagName(‘iframe’);
for (var i=0; i<vidDefer.length; i++) {
if(vidDefer[i].getAttribute(‘data-src’)) {
} } }
window.onload = init;

before the end body tag in your website


Example video

Find More about this in–depth Post here – Deferring videos

Amit Surti

I have developed a website to help Indian Railway travelers for checking PNR Status hassle-free.
How to Create a WordPress Website in 5 Easy StepsGet Started