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

前端 未结 7 1199
夕颜
夕颜 2020-11-21 06:46

I\'ve seen a couple questions around here like How to debug RESTful services, which mentions:

Unfortunately that same browser won\'t allow me to test

7条回答
  •  太阳男子
    2020-11-21 07:10

    No. The HTML 5 spec mentions:

    The method and formmethod content attributes are enumerated attributes with the following keywords and states:

    The keyword get, mapping to the state GET, indicating the HTTP GET method. The GET method should only request and retrieve data and should have no other effect.

    The keyword post, mapping to the state POST, indicating the HTTP POST method. The POST method requests that the server accept the submitted form's data to be processed, which may result in an item being added to a database, the creation of a new web page resource, the updating of the existing page, or all of the mentioned outcomes.

    The keyword dialog, mapping to the state dialog, indicating that submitting the form is intended to close the dialog box in which the form finds itself, if any, and otherwise not submit.

    The invalid value default for these attributes is the GET state

    I.e. HTML forms only support GET and POST as HTTP request methods. A workaround for this is to tunnel other methods through POST by using a hidden form field which is read by the server and the request dispatched accordingly.

    However, GET, POST, PUT and DELETE are supported by the implementations of XMLHttpRequest (i.e. AJAX calls) in all the major web browsers (IE, Firefox, Safari, Chrome, Opera).

提交回复
热议问题