Don't follow Ajax requests with a redirect

Updated . Posted . Visible to the public.

The behaviour of browsers is very inconsistent when an Ajax request is answered with a redirect. Highlights are:

  • IE 9 will follow a DELETE request with a second DELETE. You never want that.
  • Firefox will follow a POST request with a GET, as you might expect. If a PUT is redirected however, you will get a confirmation dialog, where you can choose to follow with a second PUT or simply abort. You don't want that either.

See some workarounds here.

Tobias Kraze
Last edit
Henning Koch
License
Source code in this card is licensed under the MIT License.
Posted by Tobias Kraze to makandra dev (2012-08-06 12:15)