Content

The main method to embed content directly into the target page container.

content(container:HTMLElement, options: EmbedOptions): content

or

embed(container:HTMLElement, options: EmbedOptions): content
  • The container can be any legitimate HTML5 container - usually a DIV tag.
  • The content selection and settings for the function are specified in the EmbedOptions object. This can include filters and targets for dynamically filtering content in embedded mode.
  • The method returns an instance of the "content" object, which has its own methods.

In older versions of the Embed API, the "content" method was called "embed". In newer iterations, this has been changed to "content". For backwards compatibility, developers can use still use the older function name.

Returned Content object

In older versions of the Embed API, the embed method returned the "EmbeddedResult " object via the OnLoad event in embed options. In newer iterations, the content method returns the "content" object, which is the same as EmbeddedResult. Both techniques are functional, however, the newer method is recommended.

Example

The following snippet creates the embed options object - using only the content ID of something we wish to embed - and then loads the content through the content (or embed) method into "myContainer"

const embedClient = new PyramidEmbedClient('http://pyramid:8181');
				
	var options = {contentId: "c20d42b4-be24-47cf-b711-d5782f048590"}
	var contentObj = embedClient.content($("myContainer"), options);