I have a Visualforce page that can be displayed pretty much everywhere (tab in classic, console, lightning console, lightning experience).

I have some visualisation issues when using the lightning console when the user switch to another tab and then back again to my page. I can resolve this issue by running some code when the tab get focused. The thing is, I can't find an API that works for me.

I found this: https://developer.salesforce.com/docs/atlas.en-us.api_console.meta/api_console/sforce_api_console_events_tabfocused.htm But not sure even how to integrate it to my VF (the VF is not a lightning component).

Any help would be welcomed.

1 Answer 1


Your link is to the Lightning equivalents of the Salesforce Console Integration Toolkit APIs that have been available for many years for use in Visualforce pages.

There isn't an onTabFocused function but I see there is a onEnclosingTabRefresh that may be the nearest thing. The sample code for that is:

<apex:includeScript value="/support/console/43.0/integration.js"/>

<script type="text/javascript">
    var eventHandler = function eventHandler(result) {
        alert('Enclosing tab has refreshed:' + result.id 
        + 'and the object Id is:' + result.objectId);

  • Thanks for your answer but it doesn't seem to work. When trying to register the event handler, I'm getting the following error: onEnclosingTabRefresh: Cannot get workspace from frameId: ext-comp-1005
    – Shai
    Commented Jun 24, 2018 at 17:27
  • @Shai OK, looks like that API is broken when the VF is in the Lightning Console and the Lightning API is hard/impossible to call... Hopefully someone else has a solution.
    – Keith C
    Commented Jun 24, 2018 at 17:30

You must log in to answer this question.

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