2

I have the following setup (showing a simplified version here):

  1. A CTI adapter page (hosted externally under www.example.com or localhost) uses the Console Integration Toolkit to fire an event using fireEvent().
  2. A Visual Force page is set up to receive the event using the Console Integration Toolkit addEventListener().

Now, if the Visual Force page is displayed as a tab in the Service Cloud Console, the event is received just fine.

However, if the Visual Force page is embedded as an iFrame in the externally hosted CTI adapter page, the event listener is not called (although it could be registered without errors).

Picture of the setup

Can somebody tell me what I am doing wrong or why this is not possible?


The externally hosted CTI adapter page looks as follows:

<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">

<html xmlns="http://www.w3.org/1999/xhtml">
<head>
    <script type="text/javascript" src="https://ajax.googleapis.com/ajax/libs/jquery/1.9.1/jquery.min.js"></script>
    <script type="text/javascript" src="https://c.na1.visual.force.com/support/console/31.0/integration.js"></script>
    <title>Event Sender</title>
    <script type="text/javascript">
        $(document).ready(function () {
            $("#sendEvent").on("click", function () {
                window.sforce.console.fireEvent('TestEvent', 'This is a test event that is sent to a VisualForce page in an iFrame', function (response) {
                    alert("Sending TestEvent resulted in this: " + JSON.stringify(response));
                });
            });
        });
    </script>
</head>
<body>
  <p><button id="sendEvent">sendEvent()</button></p>
  <iframe src="https://c.cs17.visual.force.com/apex/EventReceiver" width="100%"></iframe>
</body>
</html>

The Visual Force page looks like this:

<apex:page sidebar="false" showHeader="false" docType="html-5.0">
      <apex:includeScript value="https://ajax.googleapis.com/ajax/libs/jquery/1.9.1/jquery.min.js"></apex:includeScript>
      <apex:includeScript value="/support/console/31.0/integration.js"/>
      <script type="text/javascript">
        $(document).ready(function() {
          window.sforce.console.addEventListener('TestEvent', function (event) {
            $("#result").html(JSON.stringify(event));
          });
        });
        </script>
      <h1>Visual Force Page</h1>
      <p>Result: <span id="result"></span></p>
    </apex:page>
  • i think im running into the this aswell – Daniel A. White May 5 '16 at 18:47

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Browse other questions tagged or ask your own question.