{"id":37921,"date":"2018-05-05T03:01:50","date_gmt":"2018-05-04T17:01:50","guid":{"rendered":"http:\/\/www.rjmprogramming.com.au\/ITblog\/?p=37921"},"modified":"2018-05-04T22:07:14","modified_gmt":"2018-05-04T12:07:14","slug":"dynamic-javascript-and-the-youtube-embedded-api-tutorial","status":"publish","type":"post","link":"https:\/\/www.rjmprogramming.com.au\/ITblog\/dynamic-javascript-and-the-youtube-embedded-api-tutorial\/","title":{"rendered":"Dynamic Javascript and the YouTube Embedded API Tutorial"},"content":{"rendered":"<div style=\"width: 230px\" class=\"wp-caption alignnone\"><a target=_blank href=\"http:\/\/www.rjmprogramming.com.au\/HTMLCSS\/dynamic_js.html\"><img decoding=\"async\" style=\"border: 15px solid pink;\" alt=\"Dynamic Javascript and the YouTube Embedded API Tutorial\" src=\"http:\/\/www.rjmprogramming.com.au\/HTMLCSS\/msgtw.jpg\" title=\"Dynamic Javascript and the YouTube Embedded API Tutorial\"  style=\"float:left;\" \/><\/a><p class=\"wp-caption-text\">Dynamic Javascript and the YouTube Embedded API Tutorial<\/p><\/div>\n<p>Webpages without Javascript are generally pretty static and boring.  Javascript is that dynamic client addition to webpage functionality, but perhaps you only think of it as that statically written part of the webpage unable to be reloaded into effect after that initial webpage load.  Well, that is not taking into account Javascript such as &#8230;<\/p>\n<p><code><br \/>\n&lt;script&gt;<br \/>\n      var tag = document.<a target=_blank title='Javascript createElement method information from w3schools' href='https:\/\/www.w3schools.com\/jsref\/met_document_createelement.asp'>createElement<\/a>('script');<br \/>\n      tag.src = \"https:\/\/www.youtube.com\/iframe_api\";<br \/>\n      var firstScriptTag = document.getElementsByTagName('script')[0];<br \/>\n      firstScriptTag.parentNode.insertBefore(tag, firstScriptTag);<br \/>\n&lt;\/script&gt;<br \/>\n<\/code><\/p>\n<p> &#8230; taken from the excellent <a target=_blank title='YouTube IFrame Player API' href='https:\/\/developers.google.com\/youtube\/iframe_api_reference'>YouTube IFrame Player API<\/a> we really like to use around here to embed and control <a target=_blank title='YouTube' href='https:\/\/youtube.com'>YouTube<\/a> videos embedded into an HTML <a target=_blank title='HTML iframe element information from w3schools' href='http:\/\/www.w3schools.com\/tags\/tag_iframe.asp'>iframe<\/a> element.<\/p>\n<p>In today&#8217;s small extension of that we load nine such HTML iframe embedded YouTube videos into a 3&#215;3 grid.  We resisted the previous <a target=_blank title='External Javascript Genericity Follow Up Tutorial' href='https:\/\/www.rjmprogramming.com.au\/ITblog\/external-javascript-genericity-follow-up-tutorial\/'>Brady Bunch usage<\/a> of such an arrangement (perhaps you&#8217;ll be sad to hear?!) in favour of showing you a &#8220;collage&#8221; of video snippets from one of my favourite films ever, <a target=_blank title='Mr Smith Goes to Washington' href='https:\/\/en.wikipedia.org\/wiki\/Mr._Smith_Goes_to_Washington'>Mr Smith Goes to Washington<\/a>.<\/p>\n<p>We hope the HTML and Javascript <a target=_blank href=\"http:\/\/www.rjmprogramming.com.au\/HTMLCSS\/dynamic_js.html_GETME\" title=\"dynamic_js.html\">dynamic_js.html<\/a>&#8216;s code will be food for thought, that you can test for yourself at this <a target=_blank href=\"http:\/\/www.rjmprogramming.com.au\/HTMLCSS\/dynamic_js.html\" title=\"Click picture\">live run<\/a> link.<\/p>\n<p>If this was interesting you may be interested in <a title='Click here to see topics in which you might be interested' href='#d37921' onclick='var dv=document.getElementById(\"d37921\"); dv.innerHTML = \"&lt;iframe width=670 height=600 src=\" + \"https:\/\/www.rjmprogramming.com.au\/ITblog\/tag\/javascript\" + \"&gt;&lt;\/iframe&gt;\"; dv.style.display = \"block\";'>this<\/a> too.<\/p>\n<div id='d37921' style='display: none; border-left: 2px solid green; border-top: 2px solid green;'><\/div>\n","protected":false},"excerpt":{"rendered":"<p>Webpages without Javascript are generally pretty static and boring. Javascript is that dynamic client addition to webpage functionality, but perhaps you only think of it as that statically written part of the webpage unable to be reloaded into effect after &hellip; <a href=\"https:\/\/www.rjmprogramming.com.au\/ITblog\/dynamic-javascript-and-the-youtube-embedded-api-tutorial\/\">Continue reading <span class=\"meta-nav\">&rarr;<\/span><\/a><\/p>\n","protected":false},"author":1,"featured_media":0,"comment_status":"open","ping_status":"open","sticky":false,"template":"","format":"standard","meta":{"footnotes":""},"categories":[12,14,37],"tags":[2539,354,1683,1538,576,587,652,2540,997,1105,1319,1369,1418,1493],"class_list":["post-37921","post","type-post","status-publish","format-standard","hentry","category-elearning","category-event-driven-programming","category-tutorials","tag-createelement","tag-dom","tag-dynamic","tag-embed","tag-html","tag-iframe","tag-javascript","tag-load","tag-programming","tag-script","tag-tutorial","tag-video","tag-webpage","tag-youtube"],"_links":{"self":[{"href":"https:\/\/www.rjmprogramming.com.au\/ITblog\/wp-json\/wp\/v2\/posts\/37921"}],"collection":[{"href":"https:\/\/www.rjmprogramming.com.au\/ITblog\/wp-json\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/www.rjmprogramming.com.au\/ITblog\/wp-json\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/www.rjmprogramming.com.au\/ITblog\/wp-json\/wp\/v2\/users\/1"}],"replies":[{"embeddable":true,"href":"https:\/\/www.rjmprogramming.com.au\/ITblog\/wp-json\/wp\/v2\/comments?post=37921"}],"version-history":[{"count":3,"href":"https:\/\/www.rjmprogramming.com.au\/ITblog\/wp-json\/wp\/v2\/posts\/37921\/revisions"}],"predecessor-version":[{"id":37928,"href":"https:\/\/www.rjmprogramming.com.au\/ITblog\/wp-json\/wp\/v2\/posts\/37921\/revisions\/37928"}],"wp:attachment":[{"href":"https:\/\/www.rjmprogramming.com.au\/ITblog\/wp-json\/wp\/v2\/media?parent=37921"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/www.rjmprogramming.com.au\/ITblog\/wp-json\/wp\/v2\/categories?post=37921"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/www.rjmprogramming.com.au\/ITblog\/wp-json\/wp\/v2\/tags?post=37921"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}