Calling Remote Widgets - Documentation topics on: rest,restful,widgets,.

Calling Remote Widgets

Dotcms supports calling widgets between different servers using the RESTful widget api. For example, if Site A needs to display a widget that exists on Site B, then the webmaster administering Site A can use the widget api to call the “remote widget” on Site B and dynamically display Site B content. There are two methods that can be used to accomplish this.

The Import Tool

Use the import tool to call the widget using the RESTful API, similar to the following:


Load the remote widget via a Javascript Function

Javascript cost similar to the following may be used to call the remote widget:

<div id="testLoadDiv" >


Important: Javascript Security

When calling the remote widget via a Javascript function, the following must be added to the REMOTE WIDGET page before the remote widget code. This satisfies browser security and allows the injection of the remote code.

$response.addHeader("Access-Control-Allow-Origin", "")