I am trying to use the Visualforce Chatter Topics widget ( https://developer.salesforce.com/docs/atlas.en-us.pages.meta/pages/pages_compref_topics_widget.htm ). When I include the topics widget using:

<topics:widget entity="{!currentRecord.Id}" renderStyle="enhanced"></topics:widget>

on a VF page the following exception is logged to the javascript console:

Uncaught Error: Expecting identifier in canvas application client context. 

and only the widget dom is rendered, none of the javascript methods are attached, making the widget useless.

However, when I put this widget into a chatter action (easiest path to a canvas client context I could think of), the widget works great and does not log any errors to the console.

Has anyone found a work around for this? I'm mainly looking for enough JS files to import into my standard page so the Chatter component thinks it's within a canvas application :)

1 Answer 1


So, it appears the javascript error is thrown due to a resize event being sent from the component, and the component not finding a proper canvas parent to perform the resize. You can overwrite some canvas js methods to ignore this, or just live with the javascript exception.

They key part to getting this running outside of a canvas action is to do something equivalent to:

<div id="topics-container-div"><topics:widget entity="{!currentRecord.Id}" renderStyle="enhanced"></topics:widget></div>

Then after the document is loaded perform the equivalent of this javascript:

var topicContainerId = $j('#topics-container-div .topics').attr('id');

This results in a working topics widget outside of a canvas context, yay!

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .