function readOnly(count){ }
Starting November 20, the site will be set to read-only. On December 4, 2023,
forum discussions will move to the Trailblazer Community.
+ Start a Discussion
Henry Chen 1Henry Chen 1 

addEventListener won't work in VF page

<apex:page standardController="Case">

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

<script type="text/javascript">

    sforce.console.addEventListener(sforce.console.ConsoleEvent.CLOSE_TAB, function() {
        console.log("before closing ");
    });
</script>

</apex:page>
Hi guys, code above,

I tried to follow the documentation (https://developer.salesforce.com/docs/atlas.en-us.198.0.api_console.meta/api_console/sforce_api_console_addeventlistener.htm), 

but kept getting errors saying addEventListener: Unsupported Operation: This API cannnot be used on this component

Please Help!