I'm getting the following error when running my hyrbrid-remote app in the Android Emulator. Everything works fine in iOS. All of my resources are static resources in SF.

07-24 09:53:51.017: I/chromium(4474): [INFO:CONSOLE(0)] "XMLHttpRequest cannot load https://cs10.salesforce.com/!gap_exec?1406210030920. 
No 'Access-Control-Allow-Origin' header is present on the requested resource.
Origin 'https://c.cs10.visual.force.com' is therefore not allowed access.",
source: https://c.cs10.visual.force.com/apex/MobileLanding (0)

Any suggestions?

Also, if its helpful I'm using SmartStore as well.


I found this in /Smartstore/res/xml/config.xml could this be part of the issue?

 <access origin="*"/> <!-- allow local pages -->
 <access origin="https://force.com" subdomains="true" />
 <access origin="https://salesforce.com" subdomains="true" />


I found this line inside the cordova.js file which I believe is the static resource that causes the error. This gap_exec is what the the error is complaining about.

        execXhr.open('HEAD', "/!gap_exec?" + (+new Date()), true);
        if (!vcHeaderValue) {
            vcHeaderValue = /.*\((.*)\)/.exec(navigator.userAgent)[1];
        execXhr.setRequestHeader('vc', vcHeaderValue);
        execXhr.setRequestHeader('rc', ++requestCount);
        if (shouldBundleCommandJson()) {
            execXhr.setRequestHeader('cmds', iOSExec.nativeFetchMessages());
  • can you add the header Access-Control-Allow-Origin? A similar question in StackOverflow: stackoverflow.com/questions/5008944/… Commented Jul 24, 2014 at 16:30
  • @amatorVitae I don't have any access to the salesforce servers
    – Phil B
    Commented Jul 24, 2014 at 17:17
  • Good luck and god speed Commented Jul 25, 2014 at 0:30

2 Answers 2


I've seen this earlier. This can happen on emulator when your hybrid app is invoking Visualforce pages and the root cause is same as when you'd see this issue in a web application. This thread explains the issue and the solution.

In most cases, the culprit would be the requestData parameter. If you do not need it, remove it. Also, you can use add a remote site setting and then use sforce.connection.remoteFunction to overcome this issue.

This issue will/ should NOT happen on a real device though and it should work.


This may be due to the server not register these headers.

But for android you can make as patch for api 16 and greater... Find the following code:


Hope it will work for you.

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .