generates the code necessary to embed the object obj on a webpage.


generates code for an external environment or language of type "dest".


saves the generated code as files in the directory dir.


saves the generated code as a file archive in the file location loc.

Details and Options

  • In EmbedCode[obj], the object obj can be a CloudObject and a URL that contains the URL of a cloud object.
  • EmbedCode[obj] returns a string that can be inserted into the HTML of a webpage to embed obj on the page.
  • In EmbedCode[obj,"dest"], the object obj can be a function with head APIFunction or FormFunction.
  • Possible destinations for EmbedCode are given by the value of $EmbedCodeEnvironments.
  • Destinations relevant to the web include:
  • "WebPage"URL for complete webpage
    "IFrame"embed code for an embeddable iframe
    "HTML"standalone HTML code to be embedded on a page
    {"dest",framework}use the specified framework for the code generated
  • General web frameworks include "Bootstrap" and "JQueryUI". None uses no additional frameworks.
  • Destinations relevant to languages include "Java", "Python", "JavaScript", "CSharp", etc.
  • In typical cases of external programming languages, EmbedCode returns an EmbeddingObject containing an Association giving a variety of elements necessary for the embedding.
  • Typical options for EmbedCode include:
  • ExternalOptions<||>options specific to each environment or language
    ExternalFunctionNameAutomaticname to use for generated external function
    ExternalTypeSignatureAutomaticrules specifying mappings to external types
    ImageSizeAutomaticsize of embedded object in pixels
    MethodAutomaticembedding method to use
    PermissionsAutomaticpermissions to set for the cloud object
  • With the default setting Permissions->Automatic, EmbedCode[obj] will preserve the permissions for a cloud object obj and will use permissions given by $Permissions if a new cloud object is created.
  • With an explicit setting for Permissions, EmbedCode[obj] will effectively use SetOptions to change permissions of a cloud object obj.


open allclose all

Basic Examples  (4)

Create embed code for embedding on the web:

Specify the size of embedding region:

Create code for calling an API from Java:

Create code for calling a Wolfram Cloud API from Python:

Possible Issues  (1)

Language "Python" refers to Python3. Generate code for Python2:

Wolfram Research (2014), EmbedCode, Wolfram Language function, https://reference.wolfram.com/language/ref/EmbedCode.html (updated 2016).


Wolfram Research (2014), EmbedCode, Wolfram Language function, https://reference.wolfram.com/language/ref/EmbedCode.html (updated 2016).


@misc{reference.wolfram_2021_embedcode, author="Wolfram Research", title="{EmbedCode}", year="2016", howpublished="\url{https://reference.wolfram.com/language/ref/EmbedCode.html}", note=[Accessed: 18-October-2021 ]}


@online{reference.wolfram_2021_embedcode, organization={Wolfram Research}, title={EmbedCode}, year={2016}, url={https://reference.wolfram.com/language/ref/EmbedCode.html}, note=[Accessed: 18-October-2021 ]}


Wolfram Language. 2014. "EmbedCode." Wolfram Language & System Documentation Center. Wolfram Research. Last Modified 2016. https://reference.wolfram.com/language/ref/EmbedCode.html.


Wolfram Language. (2014). EmbedCode. Wolfram Language & System Documentation Center. Retrieved from https://reference.wolfram.com/language/ref/EmbedCode.html