Embedding a YouTube video in a PeopleSoft pagelet

This article describes how to create a pagelet for the PeopleSoft portal home page that contains an embedded YouTube video. It will even allow you to switch the video based on the language the user is logged in.

Create a pagelet

Create a new pagelet via PeopleTools > Portal > Pagelet Wizard > Pagelet Wizard.

Create a new pagelet and in step 2 choose Free Text as data type. Use the code displayed below as free text and adapt where needed. In step 4 choose Passthru. Finish the rest of the wizard as usual.

<div id="p1">.</div>

    var languageCd = document.getElementsByTagName("html")[0].getAttribute("lang");
    var urlDut = "https://www.youtube.com/embed/<unique identifier>";
    var urlEng = "https://www.youtube.com/embed/<unique identifier>";
    var urlFra = "https://www.youtube.com/embed/<unique identifier>";
    var url = "";
    var frameHtml = "";

    switch (languageCd) {
        case 'en':
            url = urlEng;
        case 'nl':
            url = urlDut;
        case 'fr':
            url = urlFra;
            url = urlEng;

    frameHtml = "<iframe width='560' height='315' src='";
    frameHtml = frameHtml + url + "?wmode=opaque&rel=0&modestbranding=1&showinfo=0";
    frameHtml = frameHtml + "' frameborder='0' allowfullscreen='1' ></iframe>";
    document.getElementById("p1").innerHTML = frameHtml;

You will now be able to add the pagelet to the homepage of the user. The end result will look something like this.