I've discovered that you can disable annotations on embedded YouTube videos by adding the parameter &iv_load_policy=3
to the url in the embed code.
Example:
<object width="425" height="344">
<param name="movie" value=";hl=en&fs=1&iv_load_policy=3"></param>
<param name="allowFullScreen" value="true"></param>
<param name="allowscriptaccess" value="always"></param>
<embed src=";hl=en&fs=1&iv_load_policy=3" type="application/x-shockwave-flash" allowscriptaccess="always" allowfullscreen="true" width="425" height="344"></embed>
</object>
Is there any way to force this parameter on all YouTube embed urls on a webpage using javascript/jQuery?
(Sort of like this example where you force wmode transparent on all flash objects)
I've discovered that you can disable annotations on embedded YouTube videos by adding the parameter &iv_load_policy=3
to the url in the embed code.
Example:
<object width="425" height="344">
<param name="movie" value="http://www.youtube./v/PMnEvKCtHBw&hl=en&fs=1&iv_load_policy=3"></param>
<param name="allowFullScreen" value="true"></param>
<param name="allowscriptaccess" value="always"></param>
<embed src="http://www.youtube./v/PMnEvKCtHBw&hl=en&fs=1&iv_load_policy=3" type="application/x-shockwave-flash" allowscriptaccess="always" allowfullscreen="true" width="425" height="344"></embed>
</object>
Is there any way to force this parameter on all YouTube embed urls on a webpage using javascript/jQuery?
(Sort of like this example where you force wmode transparent on all flash objects)
Share Improve this question edited May 23, 2017 at 12:07 CommunityBot 11 silver badge asked Nov 17, 2011 at 12:08 JnrkJnrk 631 silver badge8 bronze badges3 Answers
Reset to default 4Try this:
$('object').each(function(){
var $param = $(this).children(':first-child');
var newUrl = $param.attr('value') + '&iv_load_policy=3';
$param.attr('value', newUrl);
});
Done quickly without testing....
Tested and works
iv_load_policy=3
is the way to go. However there are nice embed code generators, to do it for you.
The new HTML5 player no longer uses this embed code, but I have just adapted this code to work with the iframe that is being embedded and have it working on my site. (Works with WordPress ombed too)
$("iframe").each(function() {
var src = $(this).attr("src") + '&iv_load_policy=3';
$(this).attr("src", src);
});