Reputation: 527
I have some embedded youtube playlists on my Mediawiki.
I did some speed tests with webpagetest on my website and it suggested me to defer parsing Javascript of them.
They said "JavaScript is parsed during initial page load. Defer parsing JavaScript to reduce blocking of page rendering."
They said things like this are problem.
How can I embed youtube videos to Mediawiki while deferring parsing Javascript of them until initial page load?
Upvotes: 3
Views: 4266
Reputation: 761
Just insert the embed code with jQuery.
First create a wrapper/container for the video
<div id="yt-wrapper"></div>
Then insert the embed code into the wrapper
$('<iframe width="460" height="234" src="http://www.youtube.com/embed/dQw4w9WgXcQ?rel=0" frameborder="0" allowfullscreen></iframe>').appendTo('#yt-wrapper');
Upvotes: 3