HTML5 PUT/DELETE methods not working in Chrome?

I am trying to figure out why the put/delete methods, in an HTML5 enabled site, is not working with Chrome. From what i've searched for, it sounds like it has been working for some time with Chrome, so with that said i am just looking for a few pointers to narrow down my problem. Perhaps i am implementing the form wrong, perhaps my doctype is wrong, who knows. Any help is appreciated :)

So, the code looks like this:

<!DOCTYPE html> 
<html> 

 <head> 
        <title> 
            some_resource
        </title> 
    </head> 
    <body> 
  <div class="content"> 
  <form method="put" action="/some_resource"> 
   <div> 
    <input id="title" name="title" placeholder="The Resource Title" type="text" value="" autofocus /> 
   </div> 
   <div> 
    <textarea id="body" name="body" placeholder="The Resource Body" required></textarea> 
   </div> 
   <div> 
    <input id="submit" name="submit" type="submit" value="Submit" /> 
   </div> 
   <!-- Resource Settings --> 
   <ul> 
    <li> 
     <input id="listed" name="listed" type="checkbox" value="y" /> 
    </li> 
    <li> 
     <input id="template" name="template" type="text" value="resource.html" /> 
    </li> 
   </ul> 
  </form> 
  </div> 
    </body> 
</html>

Just a basic test for a form. Now i've tried it on the Latest Ubuntu Firefox (3.6.7), Opera (10.60 Internal), and the latest Linux Chrome Beta from Google (5.0.375.99 beta). None of them seem to send the proper put method to the server, when i submit the form. Now, i believe (not from any specific research) that Firefox has yet to support this, and that like a lot of HTML5, it is scheduled for the next version of FF. Opera i do not know about, but i often hear about it keeping pace with Chrome. So.. yea, i'm a bit confused.

When submitting the form, they go to the url: http://localhost:8080/some_resource?title=t&body=b&submit=Submit&template=resource.html . Note that, as expected, POST works just fine.

Now does anyone have any pointers to get the put method working? It could be possible that the beta for Linux simply hasn't been updated to that of the Windows variety (something i assume, is what people were talking about when i saw PUT working for Chrome), but i'm really hoping it is an issue with my implementation.

Do servers have to support PUT/DELETE? (I'm using AppEngine Dev Server currently). I dunno.. hopefully someone has some ideas :)

Thanks to any replies, Lee

Note: Other HTML5 features i've tested so far are working. Eg, in that form you can see autofocus and required attributes. Those are working as intended in Chrome.

Edit1: Just to clarify, i understand support for these is sketchy. As i replied to an answer earlier, i don't care about current support in other browsers. Currently Chrome is what i want to work, and i expect Firefox to work in the upcoming release (i don't know, i just hear them pushing HTML5 a lot), and i have no idea about Opera.

All of this is simply to test and learn the new wonderful world of HTML5 (Web Workers, localStorage, etc) and CSS3. I only care about bleeding edge browsers, which are matching bleeding edge technology :)


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.)

链接地址: http://www.djcxy.com/p/41112.html

上一篇: 使用HTTP PUT方法测试文件上传

下一篇: HTML5 PUT / DELETE方法在Chrome中不起作用?