EmbeddedHTML

EmbeddedHTML["string"]

is an object that formats as a web frame containing the HTML content "string".

EmbeddedHTML[URL["url"]]

formats as a rendering of the webpage corresponding to the specified URL.

EmbeddedHTML[CloudObject[]]

formats as a web rendering of the specified cloud object.

Details

  • The string given to 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.
  • 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, EmbeddedHTML is rendered in an iframe and is robust with respect to malformed and malicious HTML.
  • The following option can be used:
  • ImageSizeAutomaticwidth and height reserved for web frame rendering
  • With ImageSize->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 EmbeddedHTML[URL[]], if a webpage's headers forbid embedding, a link is returned that opens the webpage in a separate browser window.

Examples

open allclose all

Basic Examples  (1)

Deploy a cloud notebook with embedded HTML:

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

Scope  (1)

Embed explicit HTML content:

Embed a webpage:

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

Options  (1)

ImageSize  (1)

Specify the size of the embedded HTML:

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:

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:

Neat Examples  (1)

Use HTML formatting inside a deployed expression:

Introduced in 2014
 (10.0)