I have a web app with a lot of AJAXing going on. In my original tests this was working fine, but in my testing today, Firefox (on both Mac & IE, on multiple computers), is giving a pop-up message "This web page is being redirected to a new location" for every single PUT & DELETE ajax call, which makes the page a totally unworkable mess. Interestingly, the pop-up does not occur on the GET calls.
The PUT & DELETE are both using an Angular Promise structure, while the GET uses a standard $.http call.
Here's the code of my GET, which does not trigger the pop-up:
$http({
method: 'GET',
url: $scope.faveURL
}).success(function (data, status, headers, config) {
if (data === "false") {
$scope.faveempty = true;
$scope.faveloading = false;
} else {
$scope.favourites = data;
$scope.faveloading = false;
}
});
And here's the code of my PUT & DELETE, which both do trigger the pop-up:
if (food.favourite === true) {
requestPromise = $http.put($scope.URL).then(function () {
$scope.favourites.push(food);
$scope.faveempty = false;
food.loading = "none";
change = $scope.favouriteChange(food);
});
} else if (food.favourite === false) {
requestPromise = $http({
method: 'DELETE',
url: $scope.URL
}).then(function () {
$scope.favourites.splice($scope.favourites.indexOf(food), 1);
if ($scope.favourites.length < 1) {
$scope.faveempty = true;
}
food.loading = "none";
change = $scope.favouriteChange(food);
});
}
Has anyone else experienced this problem while using requestPromise for Ajax calls? Have you found any work-arounds?
UPDATE:
Checking the Network traffic, this is only occurring on AJAX calls which respond with a redirect. This is fine, no pop-up:
[15:09:58.742] GET http://redacted/api/ext/group/35/ [HTTP/1.1 200 OK 381ms]
This causes a pop-up:
[15:03:25.036] PUT http://redacted/api/ext/favorite/713 [HTTP/1.0 301 TYPO3 RealURL redirect 126ms]
So it's a problem with the way the Typo3 services are responding to the PUT & DELETE methods, and Firefox just so happens to have dialog warning for this.