[whatwg] A thought: <a href="..." method="post">

Mark Wubben markwubben at gmail.com
Wed May 11 03:28:25 PDT 2005

I think the following things are going on here:
1) Because of easier styling links have been used for non-idempotent actions
2) The semantics defining such an action are located in the URI,
instead of HTTP. Think `/delete/$id`
3) A way to solve this would be to use buttons with good styling. The
styling will be hard to do cross-browser
4) Another way is to use `<a method="post"/>`

I'd like to expend on point 4. It would be rather easy to create an
implementation for older browsers. The problem, however, occurs when
the `href` attribute points to the non-idempotent URI: without JS
providing the compatibility, it would still evoke a non-idempotent
action on the server. A way to solve this is by linking the `href` to
a URI which asks for confirmation (through a form), while using an
`action` attribute to specify the location of the non-idempotent
action. If the spec states that `href` must not equal `action`, we
have a solution for the problem.

An example:

    <a href="/delete/$id/confirm" action="/delete/$id" method="post">delete</a>

What do you think?

More information about the whatwg mailing list