P13S
P13S

Reputation: 11

Service Cloud Toolkit API cannot be used with your browser - salesforce

Salesforce interaction/console methods not executed after redirecting to other URL in CTI console softphone.
I have mapped the CTI Adapter URL(for ex: http://domain1:port1/xyz/test.jsp) in softphone layouts of the call center, the interaction/console methods get executed on that particular page.
Method Like : sforce.interaction.runApex(...);

On click event I redirect to some other URL (for ex: http://domain1:port2/abc/test1.jsp) on this page interaction/console methods not executed.
Methods Like : sforce.console.setCustomConsoleComponentPopoutable(...);
sforce.interaction.runApex(...);

On console - "Service Cloud Toolkit API cannot be used with your browser" appears after page redirects.
Please help with the scenario

Upvotes: 1

Views: 1200

Answers (1)

Kenta Chen
Kenta Chen

Reputation: 11

This error is caused by the validation of sfdcOriginIframe and nounce properties when sending out the window message to the top window.

Actually this two properties are populated from the window.location.search field once the softphone loaded.this search field goes like :

?sfdcIFrameOrigin=https%3A%2F%2Fap5.salesforce.com&nonce=3c1d1c360732e6754323247e711324b86d027c3c2809abb163754069d02365c5&isAdapterUrl=true&

I think they come from the src of the iframe tag

<iframe
    id="SoftphoneIframe"
    name="SoftphoneIframe"
    allow="camera *; geolocation *; microphone *"
    src="/loadSoftphone.html?sfdcIFrameOrigin=https%3A%2F%2Fap5.salesforce.com&amp;nonce=3c1d1c360732e6754323247e711324b86d027c3c2809abb163754069d02365c5&amp;isAdapterUrl=true"
    style="display: block;"
    width="100%"
    height="650"
    frameborder="0"
></iframe>

if you redirect the location of your softphone frame, the search field is gone, and you can't use any methodes in interaction.js anymore.

so maybe there are two approaches to resolve this problem:

  1. retain your search field in a hidden field and bring it ot your next page as a searchQuery string;

  2. refresh your top window just before you redirect your softphone

    sforce.interaction.refreshPage();

Finally I used the second solution to fix my problem.

Code sample

Upvotes: 1

Related Questions