Hello All,
Recently application stopped working on Safari with issue 'Failed to Load Resource'. The scenario is; the web page send AJAX-Request to an aspx page and show the output into html container. The issue occurred when the request comes form https and with Safari. Basically all WebKit based browser having same issue, like Chrome and Safari.
However browser will show 200 OK as response but after it and we try to read response it will turn as 'Failed to Load Resource'.
One of the collogue found the solutions with the help of developer tool that, the missing part was content-length. We need to pass a response header specifying the content-length for all XHR loaded data.
Here is the solutions, a single line!
Response.AddHeader("Content-Length", data.Length.ToString());
This is solutions for Failed to load resource in Sarafi browser with https as well as Chrome.
Found many theories and ideas on what the issue could be, here is a wrap:
- Requiring content-length with HTTPS when making XHR (ajax) request is most likely a security requirement by webkit. Just so happens is that Chrome requires it no matter HTTP or HTTPS
- IE and Firefox may have missed this or just not part of the requirements.
- Testing on Mac Safari exposed the real error: CFURLErrorDomain:303, which is how the solution was uncovered
Hope this get also resolved your issue! It resolved mine!