html - Why don't the modern browsers support PUT and DELETE form methods? -
i finished building restful api 1 of latest apps. built simple admin interface scaffolding class enumerate resources , build simple forms , tables edit, create, delete etc.
for updating , deleting resources, class outputs form methods of put , delete, pretty simple:
<form action="/posts/xxxxxxx" method="delete"> <input type="submit" value="delete" /> </form>
and
<form action="/posts/xxxxxxx" method="put"> <input type="text" name="username" value="nikcub" /> <input type="text" name="fullname" value="nik cubrilovic" /> <input type="text" name="email" value="nikcub@email.com" /> <input type="submit" value="update" /> </form>
very simple. if javascript detected, intercept form , use xmlhttprequest submit back. javascript supports other http methods, why don't modern browsers support put , delete methods? ends sending get.
i prefer when app gracefully falls standard html same methods used, instead of having use hidden fields , logic in class, or worse, putting method in uri , allowing work.
i can't think of reasons why browsers wouldn't support other http methods, since developers working around anyway hacking or using post.
i searched answer, , able find specified part of the xhtml 2.0 spec. there no mention of in html5 spec.
any reason not being supported in 'html5 compliant' browsers? can post request open , implemented in browsers?
some web frameworks (e.g. ruby on rails) around including hidden _method
parameter in form value of "actual" method, e.g.:
<form action="/posts/xxxxx" method="post"> <input type="hidden" name="_method" value="delete"> <input type="submit" value="delete"> </form>
the framework rewrites request on server side before processing use value of _method
parameter http method.
don't know if helps you.
Comments
Post a Comment