Social Sharing JavaScript API: Social Sharing Functions

Important. The content on this page deals with a legacy feature of the Akamai Identity Cloud (in this case, social sharing). If you are currently an Identity Cloud customer and are using social sharing, that feature is still supported. However, if you’re new to the Identity Cloud, social sharing is no longer available.

The Social Sharing solution supports client-side functions that allow you to dynamically load the sharing widget to a page after it has been loaded. Use the method after the janrainSocialOnLoad function has been called to attach the share tool to an HTML element.

.addWidgetTo(element, options)

This method will accept an element to options mapping. element is required and refers to the HTML element to which the sharing widget should be attached. options is an optional JavaScript object containing settings that will override anything currently set on the element in the data-janrain-\* attributes. See the Instance Settings for a list of valid keys that may be used. Do not include the data-janrain-\* prefix. Use camelCase.

Example using JavaScript to create a new element, with options:

<script type="text/javascript">
 vare = document.createElement("div");

Example using JQuery to create a new element, without options:

<script type="text/javascript">
 varplaceholder = $("<div></div>")

Example using JQuery to add the share widget to an existing element (the last janrainSocialPlacholder element on the page):

<script type="text/javascript">$(".janrainSocialPlaceholder").get(-1),{url:""})