({{, (RefLink[EmbeddedHTML, paclet:ref/EmbeddedHTML])["string"] 
is an object that formats as a web frame containing the HTML content "string". }, {, (RefLink[EmbeddedHTML, paclet:ref/EmbeddedHTML])[(RefLink[URL, paclet:ref/URL])["url"]]
formats as a rendering of the webpage corresponding to the specified URL.}, {, (RefLink[EmbeddedHTML, paclet:ref/EmbeddedHTML])[(RefLink[CloudObject, paclet:ref/CloudObject])[…]]
formats as a web rendering of the specified cloud object.}})

OpenersNotesSection(Spacer1)Details

The string given to (RefLink[EmbeddedHTML, paclet:ref/EmbeddedHTML]) can be HTML for a full HTML page, given in the form <html> ... </html>, or can be a sequence of pure HTML tags of the kind found in the body of an HTML page.

Using JavaScript or CSS requires giving the HTML for a full HTML page.

(RefLink[EmbeddedHTML, paclet:ref/EmbeddedHTML]) is fully supported in the Wolfram Cloud System and can appear at any level in an expression. On desktop systems, it may be supported only as a separate browser window.

In the Wolfram Cloud System, (RefLink[EmbeddedHTML, paclet:ref/EmbeddedHTML]) is rendered in an iframe and is robust with respect to malformed and malicious HTML.

The following option can be used:

With (RefLink[ImageSize, paclet:ref/ImageSize])->(RefLink[Automatic, paclet:ref/Automatic]), the web frame will be large enough space to render the HTML, so long as this does not make it larger than the notebook in which it appears.

In (RefLink[EmbeddedHTML, paclet:ref/EmbeddedHTML])[(RefLink[URL, paclet:ref/URL])[…]], if a webpage's headers forbid embedding, a link is returned that opens the webpage in a separate browser window.

OpenersPrimaryExamplesSection(Spacer1)Examples  (6)

OpenersExampleSection0(Spacer1)Basic Examples  (1)

Deploy a cloud notebook with embedded HTML:

CloudDeploy[EmbeddedHTML["<b>This is bold.</b>"],"EmbeddedHTML/Basic"]

On desktop systems, a button that opens the specified HTML in a separate browser window is shown:

EmbeddedHTML["<b>This is bold.</b>"]

OpenersExampleSection1(Spacer1)Scope  (1)

Embed explicit HTML content:

CloudDeploy[EmbeddedHTML["<b>This is bold.</b>"],"EmbeddedHTML/Scope/String"]

Embed a webpage:

CloudDeploy[EmbeddedHTML[URL["https://wolfram.com"]],"EmbeddedHTML/Scope/URL"]

Deploy a form as a cloud object and embed it in a cloud notebook:

obj=CloudDeploy[FormFunction[{"x"->"Integer"},#x!&],"EmbeddedHTML/Scope/Form"]

CloudDeploy[EmbeddedHTML[obj],"EmbeddedHTML/Scope/CloudObject"]

OpenersExampleSection2(Spacer1)Options  (1)

OpenersExampleSubsection0(Spacer1)ImageSize  (1)

Specify the size of the embedded HTML:

CloudDeploy[EmbeddedHTML["<div style='background:red; width: 100%; height: 500px'>Embedded content with a scrollbar</div>",ImageSize->{400,300}],"EmbeddedHTML/Options/ImageSize"]

OpenersExampleSection3(Spacer1)Possible Issues  (2)

A webpage's headers might forbid embedding, so it will be shown as a button that opens the webpage in a separate browser tab, even in a cloud notebook:

CloudDeploy[EmbeddedHTML[URL["https://www.youtube.com"]],"EmbeddedHTML/PossibleIssues/youtube"]

JavaScript code running in the embedded HTML cannot access the outer window due to sandboxing. Any such attempt will result in a browser console error:

CloudDeploy[EmbeddedHTML["<script>alert(window.parent.document.cookie)</script>"],"EmbeddedHTML/PossibleIssues/sandbox"]

OpenersExampleSection4(Spacer1)Neat Examples  (1)

Use HTML formatting inside a deployed expression:

CloudDeploy[Manipulate[EmbeddedHTML[StringTemplate["
<!DOCTYPE html>
<html><body><h2 style=\"color:`1`\">
This text is `1`.
</h2></body></html>
"][color]],{{color,"red"},{"red"->Red,"green"->Green,"blue"->Blue}},ControlPlacement->Left,ContentSize->350]]

({{DocumentationFooterIconsRelatedFunction.png, ({{See Also}, {(RefLink[EmbeddedService, paclet:ref/EmbeddedService])  ▪  (RefLink[URLRead, paclet:ref/URLRead])  ▪  (RefLink[URLExecute, paclet:ref/URLExecute])  ▪  (RefLink[ImportString, paclet:ref/ImportString])  ▪  (RefLink[EmbedCode, paclet:ref/EmbedCode])  ▪  (RefLink[SystemOpen, paclet:ref/SystemOpen])  ▪  (RefLink[XMLTemplate, paclet:ref/XMLTemplate])  ▪  (RefLink[Pane, paclet:ref/Pane])}})}})

({{DocumentationFooterIconsRelatedGuide.png, ({{Related Guides}, {▪(RefLinkPlain[Cloud Functions & Deployment, paclet:guide/CloudFunctionsAndDeployment])}, {▪(RefLinkPlain[Web Operations, paclet:guide/WebOperations])}, {▪(RefLinkPlain[Creating Form Interfaces & Apps, paclet:guide/CreatingFormsAndApps])}, {▪(RefLinkPlain[Creating Instant APIs, paclet:guide/CreatingAnInstantAPI])}})}})