W3C home > Mailing lists > Public > whatwg@whatwg.org > May 2005

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

From: Mark Wubben <markwubben@gmail.com>
Date: Wed, 11 May 2005 12:28:25 +0200
Message-ID: <3b24e6c505051103282661831e@mail.gmail.com>
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?
Received on Wednesday, 11 May 2005 03:28:25 UTC

This archive was generated by hypermail 2.4.0 : Wednesday, 22 January 2020 16:58:41 UTC