If somebody like the post and its helpful in your work then, add comments.

Tuesday, October 4, 2011

SharePoint 2010 : Add video on Blog Post template

Open the blog site on which we want to show the YouTube video in SPD. Add below script at last of the master page before body tag.

<script type="text/javascript">
<!--
for (var i = 0; i < document.getElementsByTagName('*').length; ++i)
{if (document.getElementsByTagName('*')[i].id.indexOf('youtube') == 0)
{//get the parameters

var tagtoadd= document.getElementsByTagName('*')[i].innerHTML.split(',');
//create the string
var finalstring = '<object width="';
finalstring += tagtoadd[0];
finalstring += '" height="';
finalstring += tagtoadd[1];
finalstring += '"><param name="movie" value="';
finalstring += tagtoadd[2];
finalstring += '" /><param name="allowFullScreen" value="';
finalstring += tagtoadd[3];
finalstring += '" /><embed src="';
finalstring += tagtoadd[2];
finalstring += '" type="application/x-shockwave-flash" allowfullscreen="';
finalstring += tagtoadd[3];
finalstring += '" width="';
finalstring += tagtoadd[0];
finalstring += '" height="';
finalstring += tagtoadd[1];
finalstring += '" /></object>"';
//replace it
document.getElementsByTagName('*')[i].innerHTML = finalstring ;
}
}
//—>
</script>

Edit the post and add following tag in the html of the post body. The tag should be in below format.(<div align="center" id="youtubeSNBS1">425,355,http://www.youtube.com/v/7SGp9pA9cAY;&amp;hl=en;&amp;fs=1,true</div>

)


image


Publish the post and see the effect.


IE

image

Chrome


image


Firefox

image

It works for all the browsers.