{"id":1539,"date":"2021-03-31T21:37:44","date_gmt":"2021-03-31T19:37:44","guid":{"rendered":"https:\/\/ekiwi.de\/?p=1539"},"modified":"2022-07-23T13:28:46","modified_gmt":"2022-07-23T11:28:46","slug":"iframes-und-srcdoc-attribut-html-code-unabhaengig-in-webseiten-einbinden","status":"publish","type":"post","link":"https:\/\/ekiwi.de\/index.php\/1539\/iframes-und-srcdoc-attribut-html-code-unabhaengig-in-webseiten-einbinden\/","title":{"rendered":"IFrames und srcdoc Attribut, HTML-Code unabh\u00e4ngig in Webseiten einbinden"},"content":{"rendered":"<div id=\"ez-toc-container\" class=\"ez-toc-v2_0_82_2 counter-hierarchy ez-toc-counter ez-toc-grey ez-toc-container-direction\">\n<div class=\"ez-toc-title-container\">\n<p class=\"ez-toc-title\" style=\"cursor:inherit\">Inhalt<\/p>\n<span class=\"ez-toc-title-toggle\"><a href=\"#\" class=\"ez-toc-pull-right ez-toc-btn ez-toc-btn-xs ez-toc-btn-default ez-toc-toggle\" aria-label=\"Toggle Table of Content\"><span class=\"ez-toc-js-icon-con\"><span class=\"\"><span class=\"eztoc-hide\" style=\"display:none;\">Toggle<\/span><span class=\"ez-toc-icon-toggle-span\"><svg style=\"fill: #999;color:#999\" xmlns=\"http:\/\/www.w3.org\/2000\/svg\" class=\"list-377408\" width=\"20px\" height=\"20px\" viewBox=\"0 0 24 24\" fill=\"none\"><path d=\"M6 6H4v2h2V6zm14 0H8v2h12V6zM4 11h2v2H4v-2zm16 0H8v2h12v-2zM4 16h2v2H4v-2zm16 0H8v2h12v-2z\" fill=\"currentColor\"><\/path><\/svg><svg style=\"fill: #999;color:#999\" class=\"arrow-unsorted-368013\" xmlns=\"http:\/\/www.w3.org\/2000\/svg\" width=\"10px\" height=\"10px\" viewBox=\"0 0 24 24\" version=\"1.2\" baseProfile=\"tiny\"><path d=\"M18.2 9.3l-6.2-6.3-6.2 6.3c-.2.2-.3.4-.3.7s.1.5.3.7c.2.2.4.3.7.3h11c.3 0 .5-.1.7-.3.2-.2.3-.5.3-.7s-.1-.5-.3-.7zM5.8 14.7l6.2 6.3 6.2-6.3c.2-.2.3-.5.3-.7s-.1-.5-.3-.7c-.2-.2-.4-.3-.7-.3h-11c-.3 0-.5.1-.7.3-.2.2-.3.5-.3.7s.1.5.3.7z\"\/><\/svg><\/span><\/span><\/span><\/a><\/span><\/div>\n<nav><ul class='ez-toc-list ez-toc-list-level-1 ' ><li class='ez-toc-page-1 ez-toc-heading-level-2'><a class=\"ez-toc-link ez-toc-heading-1\" href=\"https:\/\/ekiwi.de\/index.php\/1539\/iframes-und-srcdoc-attribut-html-code-unabhaengig-in-webseiten-einbinden\/#IFrame_mit_srcdoc_erstellen\" >IFrame mit srcdoc erstellen<\/a><\/li><li class='ez-toc-page-1 ez-toc-heading-level-2'><a class=\"ez-toc-link ez-toc-heading-2\" href=\"https:\/\/ekiwi.de\/index.php\/1539\/iframes-und-srcdoc-attribut-html-code-unabhaengig-in-webseiten-einbinden\/#Escapen_von_komplexem_HTML-Code\" >Escapen von komplexem HTML-Code<\/a><ul class='ez-toc-list-level-3' ><li class='ez-toc-heading-level-3'><a class=\"ez-toc-link ez-toc-heading-3\" href=\"https:\/\/ekiwi.de\/index.php\/1539\/iframes-und-srcdoc-attribut-html-code-unabhaengig-in-webseiten-einbinden\/#Iframe_mit_srcdoc-Attribut_erstellen_mit_unserem_Online-Tool\" >Iframe mit srcdoc-Attribut erstellen mit unserem Online-Tool<\/a><\/li><\/ul><\/li><\/ul><\/nav><\/div>\n<p>HTML-Code in eine Webseite zu integrieren hat man die Auswirkung, dass CSS-Eigenschaften auf den Code angewendet werden. Die L\u00f6sung sind IFrames und mit des &#8222;srcdoc&#8220;-Attributs k\u00f6nnen IFrame ohne externen Verweis erstellt und mit HTML-Code bef\u00fcllt werden.<\/p>\n<p><!--more--><\/p>\n<p>Hier geht es zu unserem neuen Online-Tool f\u00fcr die <a href=\"https:\/\/ekiwi.de\/tools\/iframe_srcdoc\/index.html\" target=\"_blank\" rel=\"noopener\">Erstellung von Iframes mit srcdoc-Attribut<\/a>.<\/p>\n<p><iframe loading=\"lazy\" title=\"YouTube video player\" src=\"https:\/\/www.youtube.com\/embed\/zNjm9JSbSC4\" width=\"560\" height=\"315\" frameborder=\"0\" allowfullscreen=\"allowfullscreen\"><\/iframe><\/p>\n<h2><span class=\"ez-toc-section\" id=\"IFrame_mit_srcdoc_erstellen\"><\/span>IFrame mit srcdoc erstellen<span class=\"ez-toc-section-end\"><\/span><\/h2>\n<p>Bei einem normalen IFrame geben wir eine Quelle mit dem &#8222;src&#8220; Attribut an. Dies ist eine URL, welche eingebunden wird und im IFrame dargestellt wird. Mit dem &#8222;srcdoc&#8220; Attribut wird keine externe Quelle festgelegt, sondern hier k\u00f6nnen wir direkt den HTML-Code eingeben.<\/p>\n<pre>&lt;iframe srcdoc=\"&lt;html&gt;&lt;body&gt;Inhalt in einem IFrame mit dem srcdoc-Attribut,\r\n    das CSS der Seite beeinflusst diesen Inhalt nicht.&lt;\/body&gt;&lt;\/html&gt;\"&gt;&lt;\/iframe&gt;<\/pre>\n<p><img loading=\"lazy\" decoding=\"async\" class=\"alignnone size-full wp-image-1540\" src=\"\/wp-content\/uploads\/2021\/03\/iframe_1.png\" alt=\"\" width=\"661\" height=\"102\" srcset=\"\/wp-content\/uploads\/2021\/03\/iframe_1.png 661w, \/wp-content\/uploads\/2021\/03\/iframe_1-300x46.png 300w\" sizes=\"auto, (max-width: 661px) 100vw, 661px\" \/><\/p>\n<p>\n<div class=\"aawp\">\n\n            \n            \n<div class=\"aawp-product aawp-product--horizontal aawp-product--bestseller aawp-product--ribbon\"  data-aawp-product-asin=\"3836297280\" data-aawp-product-id=\"5286\" data-aawp-tracking-id=\"ekiwide0b-21\" data-aawp-product-title=\"HTML und CSS  Das umfassende Handbuch zum Lernen und Nachschlagen Inkl JavaScript Responsive Webdesign React und Angular u v m.\">\n\n    <span class=\"aawp-product__ribbon aawp-product__ribbon--bestseller\">Bestseller Nr. 1<\/span>\n    <div class=\"aawp-product__thumb\">\n        <a class=\"aawp-product__image-link\"\n           href=\"https:\/\/www.amazon.de\/dp\/3836297280?tag=ekiwide0b-21&linkCode=ogi&th=1&psc=1&keywords=buch%20html\" title=\"HTML und CSS: Das umfassende Handbuch zum Lernen...\" rel=\"nofollow noopener sponsored\" target=\"_blank\">\n            <img decoding=\"async\" class=\"aawp-product__image\" src=\"https:\/\/m.media-amazon.com\/images\/I\/51etBIPDtcL._SL160_.jpg\" alt=\"HTML und CSS: Das umfassende Handbuch zum Lernen...\"  \/>\n        <\/a>\n\n            <\/div>\n\n    <div class=\"aawp-product__content\">\n        <a class=\"aawp-product__title\" href=\"https:\/\/www.amazon.de\/dp\/3836297280?tag=ekiwide0b-21&linkCode=ogi&th=1&psc=1&keywords=buch%20html\" title=\"HTML und CSS: Das umfassende Handbuch zum Lernen...\" rel=\"nofollow noopener sponsored\" target=\"_blank\">\n            HTML und CSS: Das umfassende Handbuch zum Lernen...        <\/a>\n        <div class=\"aawp-product__description\">\n            <ul><li>Wolf, J\u00fcrgen(Autor)<\/li><\/ul>        <\/div>\n    <\/div>\n\n    <div class=\"aawp-product__footer\">\n\n        <div class=\"aawp-product__pricing\">\n            \n                            <span class=\"aawp-product__price aawp-product__price--current\"><\/span>\n            \n                    <\/div>\n\n                <a class=\"aawp-button aawp-button--buy aawp-button--icon aawp-button--icon-black\" href=\"https:\/\/www.amazon.de\/dp\/3836297280?tag=ekiwide0b-21&#038;linkCode=ogi&#038;th=1&#038;psc=1&#038;keywords=buch%20html\" title=\"Bei Amazon kaufen\" target=\"_blank\" rel=\"nofollow noopener sponsored\">Bei Amazon kaufen<\/a>\n            <\/div>\n\n<\/div>\n\n    \n<\/div>\n<br \/>\nDas Ergebnis:<\/p>\n<p><img loading=\"lazy\" decoding=\"async\" class=\"alignnone size-full wp-image-1541\" src=\"\/wp-content\/uploads\/2021\/03\/iframe_2.png\" alt=\"\" width=\"681\" height=\"293\" srcset=\"\/wp-content\/uploads\/2021\/03\/iframe_2.png 681w, \/wp-content\/uploads\/2021\/03\/iframe_2-300x129.png 300w\" sizes=\"auto, (max-width: 681px) 100vw, 681px\" \/><\/p>\n<p>Die Darstellung des Iframes unterscheidet sich nicht von einem &#8222;normalen&#8220; Iframe, die gleichen Eigenschaften k\u00f6nnen festgelegt werden. Der Vorteil ist, dass wir keine externe Quelle ben\u00f6tigen und damit die Sache auch bei Baukastensystemen durch einfaches einf\u00fcgen von HTML-Code funktioniert.<\/p>\n<p><a href=\"https:\/\/ekiwi.de\/tryit\/?id=154\" target=\"_blank\" rel=\"noopener\">Jetzt online testen!<\/a><\/p>\n<h2><span class=\"ez-toc-section\" id=\"Escapen_von_komplexem_HTML-Code\"><\/span>Escapen von komplexem HTML-Code<span class=\"ez-toc-section-end\"><\/span><\/h2>\n<p>Alles gut? Leider nicht, der Ansatz kommt schnell an die Grenzen, wenn der HTML-Code umfangreicher wird und <a title=\"Anf\u00fchrungszeichen innerhalb Zeichenkette f\u00fcr Visual Basic for Application (VBA) - Kein Syntaxfehler - kein Kompiler-Fehler\" href=\"https:\/\/ekiwi-blog.de\/24805\/vba-string-mit-anfuehrungszeichen\/\" target=\"_blank\" rel=\"noopener\">Anf\u00fchrungszeichen<\/a> und komplexere HTML-Tags enth\u00e4lt. Kurz gesagt, wei\u00df dann der Browser nicht mehr, wo das innere Dokument endet und es kommt zu Darstellungsfehlern.<\/p>\n<p><img loading=\"lazy\" decoding=\"async\" class=\"alignnone size-full wp-image-1542\" src=\"\/wp-content\/uploads\/2021\/03\/iframe_3.png\" alt=\"\" width=\"809\" height=\"258\" srcset=\"\/wp-content\/uploads\/2021\/03\/iframe_3.png 809w, \/wp-content\/uploads\/2021\/03\/iframe_3-300x96.png 300w, \/wp-content\/uploads\/2021\/03\/iframe_3-768x245.png 768w\" sizes=\"auto, (max-width: 809px) 100vw, 809px\" \/><\/p>\n<p>Um diesem entgegenzuwirken, ist es besser den HTML-Code zu escapen. Beim Escapen werden Anf\u00fchrungszeichen und die spitzen Klammern durch HTML-Entit\u00e4ten ersetzt.<\/p>\n<p><img loading=\"lazy\" decoding=\"async\" class=\"alignnone size-full wp-image-1543\" src=\"\/wp-content\/uploads\/2021\/03\/iframe_4.png\" alt=\"\" width=\"897\" height=\"267\" srcset=\"\/wp-content\/uploads\/2021\/03\/iframe_4.png 897w, \/wp-content\/uploads\/2021\/03\/iframe_4-300x89.png 300w, \/wp-content\/uploads\/2021\/03\/iframe_4-768x229.png 768w\" sizes=\"auto, (max-width: 897px) 100vw, 897px\" \/><\/p>\n<p>Das Ergebnis:<\/p>\n<p><img loading=\"lazy\" decoding=\"async\" class=\"alignnone size-full wp-image-1544\" src=\"\/wp-content\/uploads\/2021\/03\/iframe_5.png\" alt=\"\" width=\"335\" height=\"222\" srcset=\"\/wp-content\/uploads\/2021\/03\/iframe_5.png 335w, \/wp-content\/uploads\/2021\/03\/iframe_5-300x199.png 300w, \/wp-content\/uploads\/2021\/03\/iframe_5-120x80.png 120w\" sizes=\"auto, (max-width: 335px) 100vw, 335px\" \/><\/p>\n<p>Unser kleiner Test zeigt, dass wir im Iframe das <a href=\"https:\/\/getbootstrap.com\/\" target=\"_blank\" rel=\"noopener\">Bootstrap-Framework<\/a> verwenden und die Hauptseite das <a href=\"https:\/\/www.w3schools.com\/w3css\/defaulT.asp\" target=\"_blank\" rel=\"noopener\">W3.CSS-Framework<\/a>.<\/p>\n<h3><span class=\"ez-toc-section\" id=\"Iframe_mit_srcdoc-Attribut_erstellen_mit_unserem_Online-Tool\"><\/span>Iframe mit srcdoc-Attribut erstellen mit unserem Online-Tool<span class=\"ez-toc-section-end\"><\/span><\/h3>\n<p>F\u00fcr die einfache Erstellung von Iframe mit dem srcdoc-Attribut haben wir ein <a href=\"https:\/\/ekiwi.de\/tools\/iframe_srcdoc\/index.html\" target=\"_blank\" rel=\"noopener\">Online-Tool<\/a> erstellt, welches die Konfiguration und das Escapen von HTML-Code.<\/p>\n<p>Damit lassen sich auch komplexe HTML-Dokumente, wie <a href=\"https:\/\/da-software.net\/software\/da-formmaker\/\" target=\"_blank\" rel=\"noopener\">HTML-Formulare<\/a>, zu einem Iframe konvertieren und dann auf anderen Webseiten ohne Wechselwirkung einbauen.<\/p>\n<p><a href=\"https:\/\/ekiwi.de\/tryit\/?id=155\" target=\"_blank\" rel=\"noopener\">Jetzt online testen\/a&gt;<\/a><\/p>\n<p><img loading=\"lazy\" decoding=\"async\" class=\"alignnone size-full wp-image-1545\" src=\"\/wp-content\/uploads\/2021\/03\/iframe_6.png\" alt=\"\" width=\"500\" height=\"550\" srcset=\"\/wp-content\/uploads\/2021\/03\/iframe_6.png 500w, \/wp-content\/uploads\/2021\/03\/iframe_6-273x300.png 273w\" sizes=\"auto, (max-width: 500px) 100vw, 500px\" \/><\/p>\n\n<div class=\"aawp\">\n\n            \n            \n<div class=\"aawp-product aawp-product--horizontal aawp-product--bestseller aawp-product--ribbon\"  data-aawp-product-asin=\"3836297280\" data-aawp-product-id=\"5286\" data-aawp-tracking-id=\"ekiwide0b-21\" data-aawp-product-title=\"HTML und CSS  Das umfassende Handbuch zum Lernen und Nachschlagen Inkl JavaScript Responsive Webdesign React und Angular u v m.\">\n\n    <span class=\"aawp-product__ribbon aawp-product__ribbon--bestseller\">Bestseller Nr. 1<\/span>\n    <div class=\"aawp-product__thumb\">\n        <a class=\"aawp-product__image-link\"\n           href=\"https:\/\/www.amazon.de\/dp\/3836297280?tag=ekiwide0b-21&linkCode=ogi&th=1&psc=1&keywords=buch%20html%20css\" title=\"HTML und CSS: Das umfassende Handbuch zum Lernen...\" rel=\"nofollow noopener sponsored\" target=\"_blank\">\n            <img decoding=\"async\" class=\"aawp-product__image\" src=\"https:\/\/m.media-amazon.com\/images\/I\/51etBIPDtcL._SL160_.jpg\" alt=\"HTML und CSS: Das umfassende Handbuch zum Lernen...\"  \/>\n        <\/a>\n\n            <\/div>\n\n    <div class=\"aawp-product__content\">\n        <a class=\"aawp-product__title\" href=\"https:\/\/www.amazon.de\/dp\/3836297280?tag=ekiwide0b-21&linkCode=ogi&th=1&psc=1&keywords=buch%20html%20css\" title=\"HTML und CSS: Das umfassende Handbuch zum Lernen...\" rel=\"nofollow noopener sponsored\" target=\"_blank\">\n            HTML und CSS: Das umfassende Handbuch zum Lernen...        <\/a>\n        <div class=\"aawp-product__description\">\n            <ul><li>Wolf, J\u00fcrgen(Autor)<\/li><\/ul>        <\/div>\n    <\/div>\n\n    <div class=\"aawp-product__footer\">\n\n        <div class=\"aawp-product__pricing\">\n            \n                            <span class=\"aawp-product__price aawp-product__price--current\"><\/span>\n            \n                    <\/div>\n\n                <a class=\"aawp-button aawp-button--buy aawp-button--icon aawp-button--icon-black\" href=\"https:\/\/www.amazon.de\/dp\/3836297280?tag=ekiwide0b-21&#038;linkCode=ogi&#038;th=1&#038;psc=1&#038;keywords=buch%20html%20css\" title=\"Bei Amazon kaufen\" target=\"_blank\" rel=\"nofollow noopener sponsored\">Bei Amazon kaufen<\/a>\n            <\/div>\n\n<\/div>\n\n            \n            \n<div class=\"aawp-product aawp-product--horizontal aawp-product--bestseller aawp-product--ribbon\"  data-aawp-product-asin=\"3367102334\" data-aawp-product-id=\"5287\" data-aawp-tracking-id=\"ekiwide0b-21\" data-aawp-product-title=\"Einstieg in HTML und CSS  Barrierefreie und responsive Webseiten erstellen mit HTML und CSS \u2013 ganz ohne Vorwissen! Ausgabe 2024\">\n\n    <span class=\"aawp-product__ribbon aawp-product__ribbon--bestseller\">Bestseller Nr. 2<\/span>\n    <div class=\"aawp-product__thumb\">\n        <a class=\"aawp-product__image-link\"\n           href=\"https:\/\/www.amazon.de\/dp\/3367102334?tag=ekiwide0b-21&linkCode=ogi&th=1&psc=1&keywords=buch%20html%20css\" title=\"Einstieg in HTML und CSS: Barrierefreie und...\" rel=\"nofollow noopener sponsored\" target=\"_blank\">\n            <img decoding=\"async\" class=\"aawp-product__image\" src=\"https:\/\/m.media-amazon.com\/images\/I\/51Ufw8HePtL._SL160_.jpg\" alt=\"Einstieg in HTML und CSS: Barrierefreie und...\"  \/>\n        <\/a>\n\n            <\/div>\n\n    <div class=\"aawp-product__content\">\n        <a class=\"aawp-product__title\" href=\"https:\/\/www.amazon.de\/dp\/3367102334?tag=ekiwide0b-21&linkCode=ogi&th=1&psc=1&keywords=buch%20html%20css\" title=\"Einstieg in HTML und CSS: Barrierefreie und...\" rel=\"nofollow noopener sponsored\" target=\"_blank\">\n            Einstieg in HTML und CSS: Barrierefreie und...        <\/a>\n        <div class=\"aawp-product__description\">\n            <ul><li>M\u00fcller, Peter(Autor)<\/li><\/ul>        <\/div>\n    <\/div>\n\n    <div class=\"aawp-product__footer\">\n\n        <div class=\"aawp-product__pricing\">\n            \n                            <span class=\"aawp-product__price aawp-product__price--current\"><\/span>\n            \n                    <\/div>\n\n                <a class=\"aawp-button aawp-button--buy aawp-button--icon aawp-button--icon-black\" href=\"https:\/\/www.amazon.de\/dp\/3367102334?tag=ekiwide0b-21&#038;linkCode=ogi&#038;th=1&#038;psc=1&#038;keywords=buch%20html%20css\" title=\"Bei Amazon kaufen\" target=\"_blank\" rel=\"nofollow noopener sponsored\">Bei Amazon kaufen<\/a>\n            <\/div>\n\n<\/div>\n\n    \n<\/div>\n","protected":false},"excerpt":{"rendered":"<p>HTML-Code in eine Webseite zu integrieren hat man die Auswirkung, dass CSS-Eigenschaften auf den Code angewendet werden. Die L\u00f6sung sind<\/p>\n","protected":false},"author":1,"featured_media":1344,"comment_status":"open","ping_status":"open","sticky":false,"template":"","format":"standard","meta":{"footnotes":"","_links_to":"","_links_to_target":""},"categories":[5],"tags":[4,20],"class_list":["post-1539","post","type-post","status-publish","format-standard","has-post-thumbnail","hentry","category-hmtl","tag-html","tag-iframe"],"_links":{"self":[{"href":"https:\/\/ekiwi.de\/index.php\/wp-json\/wp\/v2\/posts\/1539","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/ekiwi.de\/index.php\/wp-json\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/ekiwi.de\/index.php\/wp-json\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/ekiwi.de\/index.php\/wp-json\/wp\/v2\/users\/1"}],"replies":[{"embeddable":true,"href":"https:\/\/ekiwi.de\/index.php\/wp-json\/wp\/v2\/comments?post=1539"}],"version-history":[{"count":0,"href":"https:\/\/ekiwi.de\/index.php\/wp-json\/wp\/v2\/posts\/1539\/revisions"}],"wp:featuredmedia":[{"embeddable":true,"href":"https:\/\/ekiwi.de\/index.php\/wp-json\/wp\/v2\/media\/1344"}],"wp:attachment":[{"href":"https:\/\/ekiwi.de\/index.php\/wp-json\/wp\/v2\/media?parent=1539"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/ekiwi.de\/index.php\/wp-json\/wp\/v2\/categories?post=1539"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/ekiwi.de\/index.php\/wp-json\/wp\/v2\/tags?post=1539"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}