{"id":44479,"date":"2019-04-03T03:01:33","date_gmt":"2019-04-02T17:01:33","guid":{"rendered":"http:\/\/www.rjmprogramming.com.au\/ITblog\/?p=44479"},"modified":"2019-04-02T19:55:38","modified_gmt":"2019-04-02T09:55:38","slug":"html-iframe-srcdoc-attribute-primer-tutorial","status":"publish","type":"post","link":"https:\/\/www.rjmprogramming.com.au\/ITblog\/html-iframe-srcdoc-attribute-primer-tutorial\/","title":{"rendered":"HTML Iframe Srcdoc Attribute Primer Tutorial"},"content":{"rendered":"<div style=\"width: 230px\" class=\"wp-caption alignnone\"><a target=_blank href=\"http:\/\/www.rjmprogramming.com.au\/HTMLCSS\/iframe_srcdoc.html\"><img decoding=\"async\" style=\"border: 15px solid pink;\" alt=\"HTML Iframe Srcdoc Attribute Primer Tutorial\" src=\"http:\/\/www.rjmprogramming.com.au\/HTMLCSS\/iframe_srcdoc.jpg\" title=\"HTML Iframe Srcdoc Attribute Primer Tutorial\"  style=\"float:left;\"   \/><\/a><p class=\"wp-caption-text\">HTML Iframe Srcdoc Attribute Primer Tutorial<\/p><\/div>\n<p>The HTML iframe element is a great element allowing inline new webpage content.  This is controlled, traditionally, via the attribute (and thanks to <a target=_blank title='HTML iframe element information from w3schools' href='https:\/\/www.w3schools.com\/tags\/tag_iframe.asp'>W3Schools<\/a> for the heads up here) &#8230;<\/p>\n<table>\n<tr>\n<th>Attribute<\/th>\n<th>Value<\/th>\n<th>Description<\/th>\n<\/tr>\n<tr>\n<td>src<\/td>\n<td>URL<\/td>\n<td>Specifies the address of the document to embed in the &lt;iframe&gt;<\/td>\n<\/tr>\n<\/table>\n<p> &#8230; but, as of HTML5, a new HTML iframe attribute was introduced as below &#8230;<\/p>\n<table>\n<tr>\n<th>Attribute<\/th>\n<th>Value<\/th>\n<th>Description<\/th>\n<\/tr>\n<tr>\n<td>srcdoc<\/td>\n<td>HTML code<\/td>\n<td>Specifies the HTML content of the page to show in the &lt;iframe&gt;<\/td>\n<\/tr>\n<\/table>\n<p> &#8230; featuring functionality I&#8217;ve often wanted over a long period of time.<\/p>\n<p>Today we create a &#8220;proof of concept&#8221; web application which puts this HTML iframe &#8220;srcdoc&#8221; attribute through its paces by overlaying, using our (2 out of 3, minus &#8220;opacity&#8221;) usual &#8220;overlay suspects&#8221; &#8230;<\/p>\n<ul>\n<li><a target=_blank title='CSS position:absolute information from w3schools' href='http:\/\/www.w3schools.com\/cssref\/pr_class_position.asp'>position:absolute<\/a> property<\/li>\n<li><a target=_blank title='CSS z-index information from w3schools' href='http:\/\/www.w3schools.com\/cssref\/pr_pos_z-index.asp'>z-index<\/a><\/li>\n<\/ul>\n<p> &#8230; to &#8220;slap&#8221; entire HTML iframe element contents over the top of existent content, specifying that HTML content via this &#8220;srcdoc&#8221; attribute.<\/p>\n<p>You can try this for yourself in a <a target=_blank href=\"http:\/\/www.rjmprogramming.com.au\/HTMLCSS\/iframe_srcdoc.html\" title=\"Click picture\">new window<\/a> with this, or see <a target=_blank href=\"http:\/\/www.rjmprogramming.com.au\/HTMLCSS\/iframe_srcdoc.html_GETME\">iframe_srcdoc.html<\/a> in action, in a blog posting HTML iframe, below &#8230;<\/p>\n<p><iframe style='width:100%;height:300px;' src='http:\/\/www.rjmprogramming.com.au\/HTMLCSS\/iframe_srcdoc.html'><\/iframe><\/p>\n<p> &#8230; or, perhaps, see what we mean in terms of seeing it <a target=_blank href=\"http:\/\/www.rjmprogramming.com.au\/HTMLCSS\/iframe_srcdoc.mov\" title=\"Video\">&#8220;play out&#8221;<\/a> with the Google Chrome web browser and its Developer Tools &#8220;Web Inspector&#8221; tool, below.<\/p>\n<p><video style=\"width:100%;height:370px;\" controls><source src='http:\/\/www.rjmprogramming.com.au\/HTMLCSS\/iframe_srcdoc.mov' type='video\/mp4'><\/source><\/video><\/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='#d44479' onclick='var dv=document.getElementById(\"d44479\"); dv.innerHTML = \"&lt;iframe width=670 height=600 src=\" + \"https:\/\/www.rjmprogramming.com.au\/ITblog\/tag\/iframe\" + \"&gt;&lt;\/iframe&gt;\"; dv.style.display = \"block\";'>this<\/a> too.<\/p>\n<div id='d44479' style='display: none; border-left: 2px solid green; border-top: 2px solid green;'><\/div>\n","protected":false},"excerpt":{"rendered":"<p>The HTML iframe element is a great element allowing inline new webpage content. This is controlled, traditionally, via the attribute (and thanks to W3Schools for the heads up here) &#8230; Attribute Value Description src URL Specifies the address of the &hellip; <a href=\"https:\/\/www.rjmprogramming.com.au\/ITblog\/html-iframe-srcdoc-attribute-primer-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":[2824,257,576,578,587,652,894,997,2506,2902,1319,1496],"class_list":["post-44479","post","type-post","status-publish","format-standard","hentry","category-elearning","category-event-driven-programming","category-tutorials","tag-absolute","tag-content","tag-html","tag-html5","tag-iframe","tag-javascript","tag-overlay","tag-programming","tag-src","tag-srcdoc","tag-tutorial","tag-z-index"],"_links":{"self":[{"href":"https:\/\/www.rjmprogramming.com.au\/ITblog\/wp-json\/wp\/v2\/posts\/44479"}],"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=44479"}],"version-history":[{"count":6,"href":"https:\/\/www.rjmprogramming.com.au\/ITblog\/wp-json\/wp\/v2\/posts\/44479\/revisions"}],"predecessor-version":[{"id":44485,"href":"https:\/\/www.rjmprogramming.com.au\/ITblog\/wp-json\/wp\/v2\/posts\/44479\/revisions\/44485"}],"wp:attachment":[{"href":"https:\/\/www.rjmprogramming.com.au\/ITblog\/wp-json\/wp\/v2\/media?parent=44479"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/www.rjmprogramming.com.au\/ITblog\/wp-json\/wp\/v2\/categories?post=44479"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/www.rjmprogramming.com.au\/ITblog\/wp-json\/wp\/v2\/tags?post=44479"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}