Davide Maestroni created CB-1616:
------------------------------------

             Summary: Cordova does not work if current page is not local
                 Key: CB-1616
                 URL: https://issues.apache.org/jira/browse/CB-1616
             Project: Apache Cordova
          Issue Type: Bug
          Components: CordovaJS, iOS
    Affects Versions: 2.1.0
         Environment: iOS 5.x, 6.x
            Reporter: Davide Maestroni
            Assignee: Filip Maj
            Priority: Blocker


I implemented an iOS application using Cordova 2.1.0, which, at startup, loads 
a remote web page with the _cordova-2.1.0.js_ file included in a tag "script". 
In this case the communication with the device fails and no Cordova plugin is 
accessible.
After investigating the issue, I found out the root cause in the following line:
{noformat}            execXhr.open('HEAD', "file:///!gap_exec", true);{noformat}
Basically, the problem here is that the above request never reaches the device 
if the location of the window does not start with "file://", which is exactly 
my case.
In order to fix that, I tried to modify the above line as follows:
{noformat}            execXhr.open('HEAD', window.location.origin + 
"/!gap_exec", true);{noformat}
And now it works great on any iOS device.

--
This message is automatically generated by JIRA.
If you think it was sent incorrectly, please contact your JIRA administrators
For more information on JIRA, see: http://www.atlassian.com/software/jira

Reply via email to