NEW 136081
Safari fails on request to a non-authenticated API
https://bugs.webkit.org/show_bug.cgi?id=136081
Summary Safari fails on request to a non-authenticated API
Cory.Shaw.Dev
Reported 2014-08-19 11:30:53 PDT
When attempting to make a $http.get(AngularJS) request or any Ajax get request in Safari the following error log occurs. This same get request works in all other major browsers. Feel free to see the full code here: https://github.com/coryshaw1/ng-soundcloud-playlist //SoudcloudService vm.embed = function( trackUrl ) { vm.trackUrl = trackUrl; vm.url = 'http://api.soundcloud.com/oembed?format=json&url=' + vm.trackUrl + '&auto_play=true&maxheight=200'; return $http.get(vm.url); //Example url: http://api.soundcloud.com/oembed?format=json&url=http://soundcloud.com/flume/seekae-test-recognise-flume-re-work&auto_play=true&maxheight=200 }; ... //Calling in controller SoundcloudService.embed( vm.list[index].permalink_url ) .success(function(data, status) { vm.loading = false; vm.embedHtml = $sce.trustAsHtml(data.html); //Is HTML5 iframe so handle javascript }).error(function(data, status, headers, config) { vm.loading = false; var configText = function(){ var output = ''; for (var property in config) { output += property + ': ' + config[property].toString()+'\n '; } return output; } var headersText = function(){ var output = ''; for (var property in headers) { output += property + ': ' + headers[property].toString()+'\n '; } return output; } console.log('Status:', status, '\nData:', data, '\nHeaders:', headersText(), '\nConfig:', configText()); }); //Console log Failed to load resource: https://soundcloud.com/oembed?format=json&url=http://soundcloud.com/flume/seekae-test-recognise-flume-re-work&auto_play=true&maxheight=200 Cannot make any requests from null. XMLHttpRequest cannot load https://soundcloud.com/oembed?format=json&url=http://soundcloud.com/flume/seekae-test-recognise-flume-re-work&auto_play=true&maxheight=200. Cannot make any requests from null. Status: 0 Data: Headers: Empty Object Config: method: GET transformRequest: function (d) { return isObject(d) && !isFile(d) && !isBlob(d) ? toJson(d) : d; } transformResponse: function (data) { if (isString(data)) { // strip json vulnerability protection prefix data = data.replace(PROTECTION_PREFIX, ''); if (JSON_START.test(data) && JSON_END.test(data)) data = fromJson(data); } return data; } url: http://api.soundcloud.com/oembed?format=json&url=http://soundcloud.com/flume/seekae-test-recognise-flume-re-work&auto_play=true&maxheight=200 headers: Empty Object
Attachments
Cory.Shaw.Dev
Comment 1 2014-08-19 13:27:43 PDT
I made a live build you can test with here: http://coryshaw.us/ngSouncloudPlaylist/ Search for any track title, then you should get the error when clicking "Play" next to any song.
Cory.Shaw.Dev
Comment 2 2014-08-19 13:28:37 PDT
(In reply to comment #1) > I made a live build you can test with here: http://coryshaw.us/ngSouncloudPlaylist/ > > Search for any track title, then you should get the error when clicking "Play" next to any song. http://coryshaw.us/ngSoundcloudPlaylist/ sorry typo..
Kevin Lee
Comment 3 2015-04-02 13:58:38 PDT
I'm experiencing the same issue with the following code snippet: $http({ method: 'post', url: $scope.service !== 'Photography' ? 'https://script.google.com/macros/s/identifyinginformationhere/exec' : 'https://script.google.com/macros/s/differentinformationhere/exec', params: dict }) .success(successf) .error(errorf); which generates the following three debugging output: [Error] Failed to load resource: the server responded with a status of 405 (Method Not Allowed) [Error] Failed to load resource: Cannot make any requests from null. XMLHttpRequest cannot load https://script.googleusercontent.com/macros/echo?user_content_key=moredifferentinformationhere. Cannot make any requests from null. It seems to be a CORS issue. This code works in all other browsers, just like Cory's. The request actually makes it through, because I can see modifications on the Google spreadsheet the request POSTs to, but unlike the other browsers I get a 405 and error runs. On chrome I get a 302 and successf runs.
Note You need to log in before you can comment on or make changes to this bug.