Enyo ajax request fails in mobile Safari 7, works elsewhere - javascript

I have a web app that makes cross-domain Ajax requests. The requests go through without a problem in almost every environment except for iOS devices (iPad, iPhone) running Safari 7. On those devices, the request fails. It works with the latest desktop Safari and also with mobile Safari 5; the problem is only with mobile Safari 7 (and perhaps 6; I don't have access to one of those for testing).
The app first makes a GET request to the origin site (with http protocol), which works fine. It then makes an https POST request to a different site (which is correctly configured for CORS). This is the request that fails. Nothing appears in the Safari console when the request fails and the server logs indicate that no request arrived.
One more detail that may or may not be relevant: the sequence of two requests is triggered by a single user action.
Does anyone have an idea of what's going on here?
EDIT The problem definitely appears to be related to Enyo. I created this fiddle that demonstrates the problem. If you are using Mobile Safari 7 and select enyo.Ajax as the tool for making the request, it will fail. The same request to the same URL will succeed using an XMLHttpRequest object directly. (The server-side script simply echoes the request headers. It also adds
Access-Control-Allow-Origin: *
to the response.)

Looks like this was related to a fix we made for iOS to prevent caching of non-cacheable requests. This fix was updated to only apply to iOS 6 in 2.3.0: https://github.com/enyojs/enyo/commit/73ade2a9dd68deb2f4a4db548c45e2c27104632f
Per the comments in the fix, you can use the header property to specify an object with cache-control: null, unless you're planning on upgrading to 2.3.0. :)

I ran this by the Enyo framework team. No one is exactly sure why you might be having the problem but it could be:
1) This: iOS 7 javascript XMLHttpRequest bug
2) A certificate issue with the https server.
It doesn't appear to be a framework issue, though. If the answer is something else, please let us know!

Related

XHR Post aborted in Firefox > 44, Safari and IE, but always Works in Chrome

I have a piece of Javascript fully tested and working in many different environments. In this new environment I'm currently facing, this script does not work even using the same browsers.
The problem is the following: this script does and XHR Post to a certain URL (in the same domain) but in Firefox 46 (it DOES work in firefox 43 and 44) and Safari I see in the network monitor "Aborted". In IE randomly works, otherwise remains in pending. It always works in Chrome.
Trying to debug the problem I used Fiddler, but Fiddler seems to solve the problem with all the browsers.
The website is in HTTPS, but I don't think it's an HTTPS related problem because I can directly access to the resource and I can successfully do the same POST with CURL.
It also seems to be a Client Side problem because with Whireshark I can't even see the begin of the request. It seems like the browser drops the XHR POST even before starting it.
What can be the root of this problem? What changed between firefox 44 and 46 regarding the handling of HTTP POST request?
Thanks in advance.
PS: unfortunately I cannot share the code. Anyway, since it does works in different infrastractures, maybe is not needed.
UPDATE1: I just noticed that if I wait a couple of seconds (around 30) and I do "Edit and resend" from the network monitor, the request is correctly sent. If i try before that windowd time I see the "aborted" error
This seems to be a bug in Firefox 46: http://forums.mozillazine.org/viewtopic.php?f=25&t=3005573
I just upgraded to Firefox 47, and it appears to be solved now.
thank you for your answer. You were right about Firefox, in fact I upgraded to 47 too and it was solved. Anyway the problem was still present for IE and Safari. I found as a solution, valid for all browsers, enabling the One Connect feature on the Big-IP F5 load balancer. Unfortunately it wasn't something managed by me and I hadn't access to this kind of configuration to do some tests by myself
I hope this information can be useful to someone else encountering the same problem

Configuring maximum number of simultaneous open WebSockets (in IE)

I've got this JS application. All client side JS communicating with a third party stream server via web sockets. I have about 18 different web sockets open for one page. Firefox and Chrome handle this many open web sockets at once just fine. IE11 seems to have a limitation of 4 open web sockets at once. Once I open that 5th web socket, regardless of socket call to the third-party server, I get an error thrown by IE, which closes the socket and gives the general error "SecurityError" and expanding the proto section it gives me . Seems to be pretty generic errors from my searches. At first I thought there may be a trusted zone type issue with IE, but I've added the client site to my trusted zone as well as the server providing the data.
This post provides info on max number of websockets for Firefox & Chrome, but I don't see anything specific about IE. Are there any known limitations to IE and web sockets? Answered, see edit below.
This MDN site talks about increasing the max value, but again, I can't find anything about IE. Is there some IE setting to up the amount of open connections? Answered: see below edit.
EDIT: This site shows the max connections settings for IE. It looks like it's a registry setting in Windows that controls the amount of web socket connections. Interestingly enough, I don't have that registry Key anywhere, but there is still a limit for this. The page speaks of IE10, and I'm working with IE11 specifically. Does anyone know if there are registry settings for this in regards to IE11? Has anyone just added these feature web socket registry keys and solved this issue?
The MSDN documentation you referenced is clear on the default being 6 concurrent connections (which means if not specified in the registry, that's what you'll get); and, if the documentation doesn't specify differently, it's probably safe to assume newer versions of Internet Explorer act in the same way as version 10.
Try setting through group policy. It worked for me.
https://jwebsocket.org/documentation/reference-guide/internet-explorer-tips

Web worker won't start in IE unless the cache is cleared

I'm having a really weird bug in my HTML5 script. I wrote a sharepoint app completely in OData which uses a few HTML 5 webworker to do the number crunching in the background. This works perfect on all major browsers (FF, IE10+ Chrome, ...). However, when I perform a refresh or browse to the page again. The script still works as intended on FF and Chrome, but hangs on IE.
In my network view I see a request for the Worker.js file, but with a 304 NOT MODIFIED response. IE then just hangs there on that request with a status of (Pending). This issue only gets resolved when I clear my browser cache.
I correctly close all my threads with self.close().
Any idea what the issue could be? I'm not sure if it's a code issue, a browser issue or a server side issue but I can replicate the bug on Sharepoint online as well as on a local server. The whole project is JS only, so I can't modify headers as a workaround either.
UPDATE: I ran exactly the same code outside of a sharepoint environment, and it worked perfectly. Issue is Sharepoint related.
using a time based querystring parameter prevents caching showing http status 200 on each refresh. tested on latest chrome, ie, ff;
var opus = new Worker("worker.js?q=" + new Date().getTime().toString() );
to be honest this a long shot as i do not have sharepoint right now
SharePoint sends the header:
Content-Disposition: attachment; filename="xyz.js"
X-Download-Options: noopen
and the IE Web Worker Implantation then does not run this web worker. (Tested in IE11) In the IE Network Monitor the request still on pending, even the Response text is visible.
I know so fare two workarounds:
Place the web worker js in the layouts folder (needs a Farm Solution, with the downside of this)
Set the Browser File Handling for the Web application to Permissive (maybe your security is not amused)

Firebug showing HTTP 302 error in red (no errors in apache error log)

I am experiencing a problem on the mobile version of my site where I get a HTTP 302 Found message in Firebug on Firefox, but the message is in red. I am spoofing Firefox to switch the User Agent string to mimic an iPhone, this lets me debug the mobile site on a desktop.
The problem is I cannot understand why I would get a blank response for my request, particularly when I don't get any errors in the Apache error log.
Where should I be focusing my attention on for this problem? I don't have this issue on the desktop site, which shares back-end functionality - it only occurs on mobile.
I'm also getting no JavaScript errors in the console.
The status code 302 means that the browser should open a different URL. Take a look at the headers, then you see the URL next to "Location:". Maybe there is something wrong with that URL.
The reason this does not happen with the desktop version could be that there is either no need to redirect (only the mobile site is at a different URL) or only the redirect for the mobile version is wrong.
I believe this error/warning is caused by a mixture of crossing protocols (HTTP->HTTPS) and also that the Firebug plugin for Firefox displays this scenario in red (making you believe an error has occurred).
My investigations have led me to believe that using JSONP, instead of JSON, when crossing protocols in this fashion will help.

Why Javascript Ajax call fails over SSL on IOS devices except IOS 5.

I have a mobile application that makes an ajax xmlHttpRequest request over SSL to another application on the same domain to authenticate a user. This call fails with response code zero on IOS devices prior to IOS 5 and I get told that it cannot reach the domain. It works fine on IOS 5 and desktop browsers. This application uses pure javascript, no jquery or anything like that.
Strangely, I have another application on the same domain that does a similar call over ssl to do it's authentication, and this call is successful on all devices. The only real difference of interest is that this application uses jquery.ajax() to make the call.
Debugging through Charles ssl proxy I got the same error. So, I went directly to the ajax url in the safari address bar. I was then warned about the dodgy Charles certificate and asked if I want to accept it. After doing this, the ajax call always works.. on all devices! Then, I turned off the Charles proxy, and started getting failed ajax calls again. :(
Please can someone advise me on anything they know about:
Is there any difference between IOS 5 and previous version of IOS that relates to SSL and could be the cause of this.
What does jquery do in their ajax call that could make it work when a standard xmlHttpRequest does not?
Thanks in advance...
This turned out to be a certificate error. The problem was that some browsers accepted the invalid cert and others didn't. Frustrating, but fixing the cert sorted out my problems.

Categories

Resources