Cordova ajax post issue - ios

I am working on a JQuery Mobile project. Now that I finished the core features, I want to build a native app using Cordova. After installing the project in Xcode described in the phonegap Documentation 2.7.0 the app launches and anything seems to be fine. But after firing a ajax post it returns status Code 0 and a error.
The application is currently working in all common browsers without any problems.
Do you have any ideas? Is it a CORS thing?
Thank you very much,
Flo.

(bah, I really wanna post comments instead of asking these questions in answers)
I had a lot of issues with this as well.
After a lot of research, I found that error 401 is not returned to Phonegap and becomes error 0. So my question to you is, does the website you go to require authorization?
If it doesn't, try to change your url to a non-existing one. I try to go to 'floobaloo.html', which always returns me a 404 error code. If you can not get the 404 code back, then the problem lies somewhere within your ajax call. If you do get 404 then you have Authorization issues.

Related

Angular js displays just expression in chrome

I am developing a portal using ASP.NET MVC plus AngularJS. Everything is working as expected. However, intermittently during development, when I refresh the page, I just see the angular expressions as below (in both chrome and IE 9).
I initially thought it to be a caching issue, and have disabled caching using $httpProvider as suggested here.
Any idea what is the root cause for this behaviour and how to resolve the same.
I found out that, this is due to console.* statements I had in my JS. Apparently IE does not handle those statements gracefully and throws the error. Hence, AngularJS is not processed. However, console.* statements are executed fine when IE developer tools are active (i.e you have kept it open).
I blogged about the issues I faced (specific to IE) and how I resolved those. From the blog post, this specific issue is addressed under Issue 2 (AngularJS does not execute or executes only when IE developer tools are enabled)

Rails app refreshing on localhost - event.returnValue is deprecated warning

My Rails app on localhost started randomly refreshing when using the 'back' browser arrow. Chrome(31.0.1650.48) console reads:
event.returnValue is deprecated. Please use the standard event.preventDefault() instead.
I guess these issues are connected.
I also found this recent issue on jQuery bugtracker. Funny thing, but 10 hours ago everything was fine.
Anyone experiencing similar problems? What are the options?
EDIT: although I was browsing my app on localhost, I found out that a number of production websites are experiencing the same problem, showing the same console output, including 37signals
I believe this is largely due to the newest version of Chrome that you are using. I haven't found the exact details but it appears that Chrome has decided to deprecate this property which is currently used by jQuery.
Since it's just a deprecation, nothing will be broken yet, but it does mean that it will be removed in the future. Once jQuery fixes the issue you should probably try to update.
Edit: Sorry I missed the point - I would assume that the random refreshing is unrelated to the message you are seeing about event.returnValue
Check this link out Looks like the native js method 'event.returnValue' has been marked as deprecated in newer Chrome versions. http://bugs.jquery.com/ticket/14320

Google Analytics MIME type issue in Chrome using Rails 3

I'm adding GA to a Rails 3 app, which would normally be extremely simple, of course. I've added the GA JS snippet, which is rendering just fine. Everything works perfectly in Safari. In Chrome, however, it's giving me a console error: Resource interpreted as Script but transferred with MIME type text/html: "about:blank", pointing to the JS line that loads the ga.js file: s.parentNode.insertBefore(ga, s). Some things I've investigated:
I created a plan HTML page with the JS snippet, and it loads outside Rails in Chrome with no error.
The same HTML page, when put in /public, gives the error above.
The same HTML page, loaded in Safari from /public, doesn't give any error according to Firebug.
I tried the GA Debug extension in Chrome, but it remains silent, because ga.js isn't getting loaded.
Looking at the developer console in Chrome, I see a request for "http://www.google-analytics.com/ga.js" that seems to stay in "pending" state, and a redirect to "about:blank" seemingly initiated by http://www.google-analytics.com/ga.js, which makes very little sense.
So this seems to be related to Rails (since the snippet works in the HTML outside Rails), and doesn't affect Safari, but other than that I'm stumped. Hopefully I've just been staring at it wrong, and someone else will point out the obvious to me...? Anyone come across this before? Any ideas will be very much appreciated.
Came across this issue myself. "Disconnect" disabled share buttons on my site (g+, twitter and fb). Had to remove it to view the site properly.

Recaptcha giving 404 error on Validate in SSL site

In my ASP.NET MVC 4 project, I am using the Microsoft.Web.Helpers (from the NuGet package) and my code is a very basic implementation of ReCaptcha. In my view I have:
#ReCaptcha.GetHtml(theme: "clean")
In my controller I have:
Microsoft.Web.Helpers.ReCaptcha.Validate();
The complexity comes with the SSL implementation we are using.
I have added the appropriate settings to my web.config:
<system.net>
<defaultProxy>
<proxy proxyaddress="http://***proxy script settings**"
autoDetect="False"
usesystemdefault="False"
bypassonlocal="True" />
</defaultProxy>
</system.net>
There seems like there is nothing further I can do in terms of config, but I am getting the error message
The remote server returned an error: (404) Not Found
when I hit the recaptcha validate method on the form post method in my controller.
Ive found a number of other answers on here but they all seem to suggest that you change the url, or upgrade. As Im using a NuGet package I would have thought I was using the latest version. Any ideas or links with more information greatly appreciated. Ive already done quite a bit of looking both on this site and google
edit:
I have found that earlier versions of firefox have trouble actually rendering the recapture box given our network conditions, but the latest one is fine. As the validation is done on the controller though, I suppose there is no issue here.
After much pulling of hair and general confusion, I discovered that the problem was that the POST (but not the GET) to the google API was being blocked by our corporate firewall. I had previously discounted this, because I could navigate to the service that recaptcha uses (http://www.google.com/recaptcha/api/verify).
I found this by constructing an HTML page of the requisite parts for the post and submitting it in a browser. The corporate "This page is blocked" appeared - however in code the error that is returned is a 404. The error is somewhat misleading, but this is bizarre behavior from our infrastructure department.

Error 405 on PUTs, "ignoreme.rastahook" in IIS log

We have an Asp.Net application with OpenRasta, and when we deploy it on most of our IISes (7.5), it works fine. In one installation though, for PUT requests, the client receives "405 Method not allowed" errors, and the log shows entries like:
2011-11-15 01:18:20 192.168.0.164 PUT /myapp/ignoreme.rastahook - 80 - 192.168.0.131 AClient 405 0 0 57
ignoreme.rastahook seems to come from OpenRasta's rewriting in OpenRastaModule.cs:
HttpContext.Current.RewritePath(VirtualPathUtility.ToAppRelative("~/ignoreme.rastahook"), false);
The GETs and POSTs work fine though, not sure though if the HTTP method really is what makes the difference. Any idea on what might be going on or where to start debugging? My current guess would be some IIS configuration difference between the working servers and the one that doesn't.
OpenRasta version is 2.0.3, and we run the app on .net 4.
Update:
Fwiw, when changing the verb attribute of the OpenRasta handler mapping from "*" to "GET,POST" in the web.config of my server that works, I get a "ignoreme.rastahook" in the log file as well for the PUTs, but with a 404, not a 405, so that seems to be different from the issue described above.
Update 2
I figured that when I enable WebDAV, I can reproduce the 405 / ignoreme.rastahook issue. Which lead me to https://github.com/openrasta/openrasta-stable/wiki/Installing-OpenRasta-Under-IIS , that states that
please be aware that the WebDAV module can cause problems with IIS 7.5
Update 3
I verified that WebDAV is what caused the problem on that other server, but if anyone knows how to fix the problem without disabling WebDAV altogether, I'd appreciate it.
The problem as you've seen comes from WebDAV. There is no know way that I have found bar adding the entries in your web.config to disable webdav.
This has been added to the wiki page in question.

Resources