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.

4 comments:

  1. The report center serves the purpose through a centralized hub that is specifically meant for information delivery.
    Sharepoint is a kind of central platform that helps business people during the work on different types of documents and projects.

    Sharepoint Consulting

    ReplyDelete
  2. Hi Bharat,

    I've got a problem with the display. Trying to implement your code I get a white frame where the video should appear. I get also this a message from the browser "only secure content is displayed ". After clicking the "Show all content button" nothing happens. Can you help me ??

    ReplyDelete
  3. this is not working on SP 2010. how did you get it working?

    ReplyDelete