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

James Graham jg307 at cam.ac.uk
Fri May 13 14:02:24 PDT 2005


Kornel Lesinski wrote:

> On Fri, 13 May 2005 16:56:44 +0100, James Graham <jg307 at cam.ac.uk> wrote:
>
>> That seems to be based on the belief that all things which look like  
>> links must correspond to idempotent actions.
>
>
> Yes, that is exactly the idea behind it.
>
>> I don't think this is true and, in general, think that trying to 
>> couple  the user interface to the underlying protocol is a bad idea.
>
>
> That is user interface which represents what protocol does.
>
> Links are not coupled with http GET method. You may link to any 
> resource  using any protocol, but following a link should not have 
> side-effects - by  design.
>
> Web applications usually don't have undo, so IMHO it should be clear 
> that  click on certain UI elements has side effects.

But that's already unclear. Given a button on a web page it's impossible 
(without context) to tell if it has side effects or not. If I click the 
"Search" button on Google, it has no side effects yet the "Submit Order" 
(or whatever the exact working is) button on Amazon, despite being 
exactly the same type of UI element, has side effects. The same is true 
in offline UIs - the Save menu item in my text editor is non-idempotent 
yet the close-by Open  menu item is idempotent. In general, it's hard to 
think of a class of UI where it's unambiguous which actions will have 
side effects just from the visual presentation of the elements and 
without additional contextual information.

Despite this, people have the desire to make links a special class of UI 
object that correspond to idempotent actions only. From a purely 
mechanical point of view, this makes sense - after all one doesn't want 
bots to follow links. From the point of view of that part of the web 
that consists of interlinked documents it mostly makes sense. But from 
the point of view of web applications, it doesn't make sense. It makes 
no sense to require a webmail application to use a form element to open 
each message just because doing so modifies the underlying database, 
despite the fact that a link is an appropriate element to represent the 
action.

Fortunately for the UI designers, there is an acceptable alternative to 
a link. It's <span> with  javascript to provide the  behavior. Even if 
there was a way to ensure that links were _never_ used for 
non-idempotent actions, you'd still see link-like elements used for such 
actions. Unfortunately they'd have none  of the semantic value  offered 
by <a> elements.

-- 
"But if science you say still sounds too deep,
Just do what Beaker does, just shrug and 'Meep!'"

-- Dr. Bunsen Honeydew & Beaker of Muppet Labs




More information about the whatwg mailing list