+ Start a Discussion

actionFunction cross Domain Error

It is not a question, I share my experience because I spent hours on this...
on my visualforce page, chrome kept telling me (in the Javascript console):
XMLHttpRequest cannot load https://eu3.salesforce.com/_ui/common/request/servlet/JsLoggingServlet.
No 'Access-Control-Allow-Origin' header is present on the requested resource.
Origin 'https://c.eu3.visual.force.com' is therefore not allowed access.
Browsing the net, I didn't find info on this error.
At the end, It appears this was due to a call to the "alert" javascript box just before the call to an "<apex:actionFunction". See below,
Javascript is:
function jsRemoveLineItemCatBtn() {
alert( 'CURRENT ID ' + vLICInProgressNum );
afRemoveLineItemCatBtn( String(vLICInProgressNum) );
where afRemoveLineItemCatBtn is the name of my action function.
Since I commented the call to alert, I don't have the error message anymore...
Hope to help few to save time.
Gordon EngelGordon Engel
There is an internal Salesforce setting that allows VF content to be served from the Salesforce.com domain.  This perm is probably turned on for your org, which causes your alert to try to load the JsLoggingServlet from the Salesforce.com domain.  The browser blocks this because it thinks it is an attempt to do a Cross Origin Resource Sharing (CORS) security exploit.

The perm for rending VF content from the salesforce.com domain should be off for most orgs.