[whatwg] Targetting different anchors after submitting the form

Lachlan Hunt lachlan.hunt at lachy.id.au
Mon Mar 6 14:07:37 PST 2006


Mikko Rantalainen wrote:
> Currently it's possible to do stuff like this
> 
> <form action="url#anchor">
> <input name="foo" type="submit">
> <input name="bar" type="submit">
> </form>
> 
> and the UA scrolls down to element with id "anchor" on the page returned 
> by the server. It would be nice to be able to set target anchor on 
> per-submit-button basis.
> 
> Perhaps something along the lines
> 
> <form action="url">
> <input name="foo" type="submit" anchor="xfoo">
> <input name="bar" type="submit" anchor="xbar">
> </form>
> 
> would result to action urls "url#xfoo" and "url#xbar" respectively. 

You could get the server to send a 303 See Other response and set 
Location: http://example.com/url#foo.

RFC 2616:
303 See Other

    The response to the request can be found under a different URI and
    SHOULD be retrieved using a GET method on that resource. This method
    exists primarily to allow the output of a POST-activated script to
    redirect the user agent to a selected resource.

-- 
Lachlan Hunt
http://lachy.id.au/




More information about the whatwg mailing list