[Web-SIG] empty action attribute with forms in Google Chrome
t.broyer at gmail.com
Tue Apr 28 10:01:04 CEST 2009
On Mon, Apr 27, 2009 at 11:19 PM, Randy Syring <randy at rcs-comp.com> wrote:
> For the last four years, I have always used an empty action attribute on my
> form to make it post back to the current URL. I almost always validate my
> HTML and this has never come up as a violation. Furthermore, I have read
> various people on the web advocating this practice.
> Recently, however, I went to use Google Chrome to look at some of my web
> apps and I noticed that none of my forms work. In use a <base> tag and
> empty form attributes. Whenever I submit a form in Chrome, it gets posted
> to the root URL (i.e. what I have in my <base> tag). Am I violating the
> spec or is this something Google Chrome got wrong?
You are violating the spec (or, actually, this a bit of a blurry thing
in the spec re. a "same document reference").
> What I have works in IE, FF, and Opera.
Yes, because they're violating the spec too. HTML5 defines the form
submission to violate the RFC 3986 to make it work like IE, FF and
http://www.w3.org/TR/html5/forms.html#form-submission-algorithm (step 9)
The comments there (an HTML comment, look at the source of the page) says:
<!-- Don't ask me why. But that's what IE does. It even treats
action="" differently from action=" " or action="#" (the latter
two resolve to the base URL, the first one resolves to the doc
URL). And other browsers concur. It is even required, see e.g.
(I'm not sure web-sig is the appropriate list for these questions, as
they're unrelated to Python; maybe http://www.whatwg.org/mailing-list
or http://forums.whatwg.org/ )
More information about the Web-SIG