open-cti-demo-adapter
open-cti-demo-adapter copied to clipboard
Cross origin frame issue
Hello guys
Im trying to install the Open cti package and to make it works for demo before playing with it and customize it, but the softphone does not appear why clicking on the Phone tab in the console.
Here is the issue I face Blocked a frame with origin "https://MYDOMAIN.my.salesforce.com" from accessing a cross-origin frame. No 'Access-Control-Allow-Origin' header is present on the requested resource.
Any clue on how this can be solved? Im working on a developer edition for now
Thanks a lot!
Hi, Can you please change the CTI Adapter URL in the Call Center to an absolute url, from /apex/demoAdapterPage to something like https://MYDOMAIN.my.salesforce.com/apex/demoAdapterPage ?
Then try again
Hi David and thanks for your answer I had setup the url adapter url correctly and still getting that issue. Not sure for where it comes from Best Regards
What is the error you're getting?
Hi David,
I'm getting the same error. When accessing any page from the Service Cloud Console I can see this error:
iframeinterface.js:1 Uncaught DOMException: Blocked a frame with origin "https://
And when I try to make a call (I have already set up Twilio for that) I get this error on the Softphone page when it's dialing: Uncaught DataCloneError: Failed to execute 'postMessage' on 'Window': [object Object] could not be cloned. throws at https://
I have added those URLS to the CORS settings but unfortunately it doesn't make any difference.
Could you please give some advice ? :)
Thanks, Manuel
what is the adapter url in the call center settings? is it relative or absolute? are you using a dev org with a namespace or an enterprise edition org? In most cases, if your My Domain is say, 'manuel', the adapter URL in the call center settings needs to be https://manuel.my.salesforce.com/apex/demoAdapterPage
hope that helps!
David
Hi David,
My URL in the call center settings is absolute (https://xxx-dev-ed.my.salesforce.com/apex/demoAdapterPage). I'm using a dev org without namespace.
What I can see in the console log is as follows: Uncaught DOMException: Blocked a frame with origin "https://xxx-dev-ed.my.salesforce.com" from accessing a cross-origin frame. at Object.handleOnload (https://xxx-dev-ed.my.salesforce.com/support/console/xdomain/30.0/iframeinterface.js:1:356) at window.onload (https://xxx-dev-ed.my.salesforce.com/support/console/xdomain/30.0/crossDomainProxy.html:4:89)
I created a Lightning console app for testing this out. Do you happen to know what I missed out? :)
Regards, Manuel
hmm... it looks ok so i'm not sure what went wrong. Can you try with an enterprise edition org? (you can sign up a free trial one if you don't have one). If that doesn't work, maybe you could open a case with salesforce support.
Hi, David The same issue - http://take.ms/6bK8E But Phone tab is working (i can login and use CTI) P.S. Org was created day ago
Hi, Similar issue when I try to do sforce.opencti.isSoftphonePanelVisible({callback: callback});
or any other CT methods from this doc Link
from any of my VFPage added in service console I get this error .. I tried setting the same URL inside open_cti.min.js It doesn't work still..
Any help on how to open soft phone on from a custom VFPage added in Service console will be really help full. Thanks in Advance. :)

Was anyone to resolve the issue ? I'm trying to simulate an incoming call to open a matching contact, but the CTI component goes blank with DOMExceptions in the browser console. Any help appreciated !
Just to be clear, same issue as @tejeirodelrio in a developer org.
Any updates? Is an enterprise edition org required instead?
Update:I still have the issue, but it seems that the phone is working. So maybe we can simply ignore this issue.
Hey guys,
I have been having a similar problem while developing a package using the Salesforce Open CTI extension for a SFDC Telephony Integration project in my company. It seems that after an update calling any code in sforce.opencti.* that is relying on server communication, as for example sforce.opencti.screenPop is failing because of iframe to parent window communication (postMessage).
I could not get sforce.opencti.screenPop working inside AURA, but a small workaround helped me fixing the problem:
In the callback (here it is 'then') that is creating the lightning out adapter
$Lightning.use("softphoneOut", function() {
$Lightning.createComponent(
"softphone",
{},
"lightning",
then
)
});
Just add an alias to the sforce functions:
window.$Force = sforce;
Then inside of AURA you can use: $Force.opencti.screenPop which works without any problems.
A full example could be:
$Lightning.use("softphoneOut", function() {
$Lightning.createComponent(
"softphone",
{},
"lightning",
function() {
window.$Force = sforce;
}
)
});
...
$Force.opencti.screenPop({
type: $Force.opencti.SCREENPOP_TYPE.SOBJECT,
params: {
recordId: recordId
}
});
I hope this helps!
@espspinix Thanks a lot !! It works. Could you help me understand how it works ?
@espspinix do you mind creating a pull request with these changes so others can enjoy it?
thanks, David
I was stuck on this two months ago. I did lots of investigation and it turned out it's pretty easy to start from scratch (without this library). Here is a 10-minutes demo for you to integrate RingCentral into Salesforce: https://github.com/ringcentral/ringcentral-web-widget/issues/7
The solution takes RingCentral as example, but the method should apply to other vendors.
Any update on this? I tested in developer edition, the console page is redirect me to the demonAdpaterPage to sign in. Given the sfdcIframeOrgin is in *.lightning.force.com instead of *.visual.force.com, it always fail to execute 'postMessage" on "DOMwindow": The target origin provided ('<URL>'< does not match the recipient window's origin ('<URL>'). I tried methods mentioned above, yet did not work for me.
Im getting this error....
Refused to execute JavaScript URL because it violates the following Content Security Policy directive: "script-src 'self' 'nonce-57d8d4d6-e70b-d93b-10de-0da8b6751459' chrome-extension: 'unsafe-inline' 'unsafe-eval' https://sfdc.azureedge.net *.na57.visual.force.com 'unsafe-eval' https://ssl.gstatic.com/accessibility/". Note that 'unsafe-inline' is ignored if either a hash or nonce value is present in the source list.
Any ideas?
HI,
Keep getting this error, when click on phone.
SecurityError: Blocked a frame with origin "https://-----.my.salesforce.com" from accessing a frame with origin "https://-----.lightning.force.com". Protocols, domains, and ports must match. handleOnload onload I tried below to resolve this but it doesn't go :
- Whiltelisting iframe URL on CORS
- adding domain name in adapter URL for demoAdapterPage.
- Disabling cross window navigation in chrome.
- Updating code as per espspinix comment above.
I am testing this on Safari and Chrome, but it seems not working for me. Don't want to use any other vendors API but wanted to use what all demo adapter provides but no luck yet :(
Thanks in advance.
Hi,
any generic solution to this issue? i have tried CORS settings and what @espspinix explained but no luck.
@dlouvton : is there any update with a working fix ?
Thank you
Im getting this error....
Refused to execute JavaScript URL because it violates the following Content Security Policy directive: "script-src 'self' 'nonce-57d8d4d6-e70b-d93b-10de-0da8b6751459' chrome-extension: 'unsafe-inline' 'unsafe-eval' https://sfdc.azureedge.net *.na57.visual.force.com 'unsafe-eval' https://ssl.gstatic.com/accessibility/". Note that 'unsafe-inline' is ignored if either a hash or nonce value is present in the source list.
Any ideas?
Hey, did you find any solutions to this? This happens on list view of contact: Refused to run the JavaScript URL because it violates the following Content Security Policy directive: "script-src 'self' 'nonce-b3c546f8-ab5b-d9c9-98bf-1783b8041fa1' chrome-extension: 'unsafe-eval' https://sfdc.azureedge.net *.visualforce.com https://ssl.gstatic.com/accessibility/ https://static.lightning.force.com". Either the 'unsafe-inline' keyword, a hash ('sha256-...'), or a nonce ('nonce-...') is required to enable inline execution.
When I deployed the code using SFDX I had the same issue "Uncaught DataCloneError: Failed to execute 'postMessage' on 'Window'", but when I installed the package it worked. I couldn't figure it out the reason. I used the same settings in both cases. Any suggestions?
Hey, did you find any solutions to this? This happens on list view of contact: Refused to run the JavaScript URL because it violates the following Content Security Policy directive: "script-src 'self' 'nonce-b3c546f8-ab5b-d9c9-98bf-1783b8041fa1' chrome-extension: 'unsafe-eval' https://sfdc.azureedge.net *.visualforce.com https://ssl.gstatic.com/accessibility/ https://static.lightning.force.com". Either the 'unsafe-inline' keyword, a hash ('sha256-...'), or a nonce ('nonce-...') is required to enable inline execution.
I'm getting a much basic error that says
Cannot read property 'opencti' of undefined
I have included the necessary resources:
<script type="text/javascript" src="/support/api/38.0/lightning/opencti.js"></script>
<script src="/support/api/40.0/interaction.js" type="text/javascript"></script>
I am building a very basic implementation, but cannot seem to get it to get the softphone to work as expected. I can place a call, but the component fails.
Can anyone here tell me what I seem to be missing here?
Can you make sure the script is loaded. This error comes when the js is not loaded.
May be put a time delay on load the cti method just to test.
Hi @nikhilcloudroute I figured out the issue. I was loading the resource via a relative URL, turns out that I had to use the absolute URL. It is working now.
Great!
My problem was that I had amazonconnect appended to my salesforce url in my allowed URLs in AWS. Maybe this will help someone in the future.
I have the same problem. Is there any update with fix ?
Hi @nikhilcloudroute I figured out the issue. I was loading the resource via a relative URL, turns out that I had to use the absolute URL. It is working now.
Could you please share the path that you are referring to.
Thanks.
@nikhilcloudroute @ManjunathGithubAcc can you guys please post here the solution? Thanks