I have the following code where I am trying to embed a youtube player into a html file . I do not see any errors in the developer console. But the youtube player is not added where the div for the player is added in the html file. \[code\] <form name="urlReaderForm" onSubmit=" return validateForm()" method="post"> Url: <input type="text" name="url"><BR> <input type="submit" type="submit" value="http://stackoverflow.com/questions/14032785/Submit"> </form> <div id="youPlayer"></div> <script> function validateForm() { var url=document.forms["urlReaderForm"]["url"].value; var loopCounter=document.forms["urlReaderForm"]["times"].value; var len = url.length; var vIDpos=url.indexOf("v="); var vID=url.substring(vIDpos+2,len-1); alert(''+vID); var html_var=''; html_var ="<object style='height: 390px; width: 640px'> <param name='movie' value='https://www.youtube.com/v/'"+vID+"'?version=3&feature=player_embedded&loop='"+loopCounter+"'&playlist='"+vID+"'><param name='allowFullScreen' value='http://stackoverflow.com/questions/14032785/true'><param name='allowScriptAccess' value='http://stackoverflow.com/questions/14032785/always'><embed src='https://www.youtube.com/v/'"+vID+"'?version=3&feature=player_embedded&loop='"+loopCounter+"'&playlist='"+vID+"' type='application/x-shockwave-flash' allowfullscreen='true' allowScriptAccess='always' width='425' height='344'></object>?"; document.getElementById("youPlayer").innerHTML = html_var; } </script>\[/code\]