Doing a HTTP PUT from a browser

It seems that most browsers don’t support other methods besides GET and POST since it is a limitation of HTML forms.
Here’s another question on the topic:

Are the PUT, DELETE, HEAD, etc methods available in most web browsers?

In order to simulate the PUT, DELETE, etc. methods, you could add a hidden input to a regular GET/POST form with the pseudo-method and have your application translate it so that your controllers see it as if it were a true PUT request, as you mentioned. I’ve seen this method used in google sitebricks (in java – sorry I don’t have any rails-specific reference, but this might at least give you an idea) in this code. I think this is probably the method we are stuck with until something in HTML spec changes (and the browsers with it)

However, GET, POST, PUT and DELETE are supported in AJAX by the major browsers, so there should be no need for a hidden input if you aren’t relying on the HTML form.

Leave a Comment