New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Ajax calls fail - is it because URL is http://phonegap-serve-ip and not file://some-local-file? #169
Comments
yup we're working on a CORS fix and should have something soon |
Great to hear! It is a great product and this would make it useful for testing full apps. |
Hey there, We do have a fix in the latest version of https://github.com/phonegap/connect-phonegap for ajax calls. Perhaps you may need to update the node module to get it working? |
Hi, I updated phonegap - I no longer get CORS type of exceptions, but it seems the ajax call just stays forever - $.active shows 0 before the call, and then for each new call increases with 1. |
I'm using phonegap 3.5.0-0.20.4 and running with: phonegap serve I should add that if I build the app through phonegap and install it, then it works as expected. |
Hi again, Hrm, you are running a version of phonegap which should work. I'm not too sure exactly why either at this point but it does seem like it could be the phonegap serve or dev app. Could you post a code sample? |
I'll post example code, but it really is a very basic ajax call - similar to what is described in issue 51 in connect-phonegap - and when running from the app packaged with phonegap build, then it runs perfectly (on the same device and same network/url etc). Adding some additional findings after logging the ajax call object. Coud it be relating to: phonegap/connect-phonegap#51 |
Hi guys. Just want to let you know that I'm having the same issue as @jornklung. Tested on iOS7 and WP8 |
@djfranzwa We've published a patch for the ECONNRESET issue. Would you mind updating to the latest CLI version and giving it another shot? Reference: phonegap/connect-phonegap#75 |
Hello! I'm glad to say that I've updated my Node.js to v0.10.31 and now I'm able to make ajax POST calls to my server, which wasn't working on v0.10.29, with phonegap serve. I'm using phonegap 3.5.0-0.21.14 that combined with latest Node.js (v0.10.31), it creates a proxy to the ajax request and everything is working just fine. I'm testing my app written in a Windows 7 machine, running it on an iPhone. Amazing! |
@mwbrooks everything works 110% Thanks so much for doing an awesome job with phonegap (serve). You guys are the best. |
@robsonselzelin @djfranzwa great to hear guys! I'll leave this issue open until we roll out the next milestone, which should apply for more broad fix. Regardless, it's good to hear that the upgrade has helped you out! |
Guys, I'm on v3.6.0-0.21.19 (and node v0.10.32) and still face this issue. Testing on Windows 7 (android platform) My code is here -> http://stackoverflow.com/questions/26748796/phonegap-and-cors-xhr-status-0-issue |
The problem persists on latest verison 4.1.2, it is not proxing to the same ip on other port. |
Hi, I've now finally gotten back to test this and it works great if the url is on a different ip/name - but it does not work for requests to different port but same ip as phonegap serve is running on - likely same isssue as @whitecolor If I run phonegap serve on http://192.168.1.40:3000 then request to http://some.domain.com works fine, but request to http://192.168.1.40:8888 does not work. What is odd is that requests on the same ip (but diff port) does not show any activity in the phonegap serve console, however the request reaches the target server but the response is not getting back. Hope this helps. Thanx for great improvements! btw using: |
Hi, We are developing a project using phonegap for iOS and Android. One of the features we implemented depends on calling another page from within the phonegap project using ajax. This works fine on iOS and Android 4.0, however due to the Android Lolipop using Chrome as a default browser, now our links dont work and we get a CORS error. XMLHttpRequest cannot load file:///Users/sou/login%20page/www/restodetails.html. Cross origin requests are only supported for protocol schemes: http, data, chrome, chrome-extension, https, chrome-extension-resource. Android 5.0 was just realeased a few months ago and now we have to fix this issue. Has anymore come across an issuel ike this loading another file from within the app? Please help! |
Hi @souhailalavi, By the sounds of it, this isn't a PhoneGap Developer App issue (directly). I've just spoke with @infil00p and he suggested that this issue may have been resolved in the latest Cordova Android release, which coincidently came out on Friday. If you're building the Android app locally, then you can try to upgrade to Cordova Android 3.7.0, which apparently disables CORS by default. However, the PhoneGap Developer App is running Cordova Android 3.6.x, so you'll still experience the CORS issue with it. You can install the latest Cordova Android with:
Cheers, |
I am also facing the exact same issue as @whitecolor and @jornklung mentioned above. Probably it is an issue with phonegap developer app ? |
I wondering if there is any solution for simple Ajax cross site GET request in HTML5 app using PhoneGap?
I have allow
|
With the 1.5.2 release, AJAX calls should now work like it normally does in a PhoneGap app. |
Hi,
PhoneGap App Developer is a great concept - got it up and running.
However there seems to be an inherint problem with doing Ajax calls/requests.
We have an app that catches content from a server.
This works fine when running the app as an installed app as the URL is file://some-local-file
BUT when running it with PhoneGap App Developer the URL becomes the URL of the phonegap server which PhoneGap App Developer is connected to.
When doing the AJAX calls they get rejected due to what seems like cross domain requests.
Do you have any suggestion on how to solve this problem?
Thanx for a great product and service!
Jørn
The text was updated successfully, but these errors were encountered: