Why do not browsers implement HTTP PUT and DELETE protocols?


For some reason Internet browsers (Chrome, Firefox, IE, ...) have just decided to implement the HTTP protocol's GET and POST methods.

Other methods such as PUT and DELETE are left out.


My question arose because #


The Rails framework encourages RESTful design of your applications, which means you'll be making a lot of "PATCH" and "DELETE" requests (besides "GET" and "POST"). However, most browsers do not support methods other than "GET" and "POST" when it comes to submitting forms .

What translated is:


The Rails framework encourages the use of the REST pattern in your applications, which means you will make multiple "PATCH" and "DELETE" (in addition to "GET" and "POST"). However, most browsers do not support methods other than "GET" and "POST" when using forms .

Note: therefore, apparently, these methods are only supported via tag <form>...</form> .

asked by anonymous 23.05.2014 / 14:48

2 answers


This response is yet another huge comment to the answer of @carlosfigueira, but that contains some information until interesting.

As for the declaration of modern browsers implementing the other HTTP Verbs , I have my doubts there. That's because a year ago me and some forum colleagues tested and at least Chrome, Opera and Safari, updated until then, only complied with POST. The others (PUT, DELETE, OPTIONS ...) have assumed the GET method.

In other words, in order for you to use these other verbs in the server-side application, you have two alternatives, one of which is a small gambiarra because it violates RFC 2616 :

  • Use XHR . Pro: You can use any verb you need. Against: Obstructive! If your Application is dependent on JS and it is not available, it does not work.
  • Pass the verb directly in the URL or by some hidden field.

    For example, to delete a user without full support for the DELETE verb, we would have:


  • 24.05.2014 / 03:58

    That's not true. All modern browsers (i.e., IE, Chrome, Firefox, Safari that have been released for at least the last 3 years, possibly much more) support all HTTP methods. GET is supported on multiple scopes, as with all tags with a src attribute (e.g., <script src="o endereço que será acessado via GET"></script> ).

    To use the other methods, you usually use the XMLHttpRequest object, where you define the HTTP method that want to use open() .

    There are still other ways to send HTTP requests through the browser, for example in% w /% of% w /%. In this case browsers do not support methods other than GET and POST, the definition of HTML forms limits verbs to only those two. See HTML 4 or HTML 5 for more details.

    One problem you may be encountering is that there are some server configurations that do not support requests using PUT or DELETE - there are some versions behind the default IIS configuration this way (you can enable the other methods by changing the configuration). But that would be a server problem, not the browser.

    23.05.2014 / 15:49