HTML5 PUT/DELETE methods not working in Chrome?
PUT and DELETE are no longer supported methods for the <form>
tag. See
HTML5 differences from HTML4 (19 Oct 2010)
There is no “HTML5”, as a monolithic standard.
Some of it's the same as HTML4. Some of it's ratifying technically-non-standard features that every browser implements and everyone's used for years. Some of it's new extensions that the browser vendors mostly agree on and are in various stages of implementation. Like, for example, autofocus
.
But then some of it is spottily-implemented stuff that is likely to change before it's standardised, and some of it's random bonus features that some random people at WHATWG thought would be nice, but which shows no sign of support from the browser authors.
There is less of this latter category than there used to be (early WHATWG drafts were almost as full of architect-astronomy badness as XHTML 2.0), but there's still some, and currently, the extended form submission types (PUT/DELETE methods and some of the non-HTTP actions) are in that category. Every browser currently ignores method="put"
, falling back to the default attr value get
instead.
Maybe one day browsers will implement this. Or maybe it'll be excised from the spec. HTML5 is still a long way from finished. For now, just use POST
like everyone else. It's not quite pure RESTfulness, but then that doesn't really get you anything special.
<input ... autofocus />
Use HTML or XHTML syntaxes, but don't mix them. autofocus="autofocus"
for XHTML5, or for HTML5 lose the self-closing /
.
<input id="submit" name="submit" type="submit" value="Submit" />
Best avoid naming a button that, to avoid clashes with the form.submit()
method. You don't need name
on a submit button unless you need to check for a click on one particular button, anyway. (And you don't need to add id
s to all your fields either. Unless you need an id
for <label for
or script targeting, you can leave them out.)