Is it a good practice to use an empty URL for a HTML form's action attribute? (action=“”)

后端 未结 11 2316
花落未央
花落未央 2020-11-22 01:50

I am wondering if anyone can give a \"best practices\" response to using blank HTML form actions to post back to the current page.

There is a post asking what a blan

11条回答
  •  悲哀的现实
    2020-11-22 02:16

    I think it's best to explicitly state where the form posts. If you want to be totally safe, enter the same URL the form is on in the action attribute if you want it to submit back to itself. Although mainstream browsers evaluate "" to the same page, you can't guarantee that non-mainstream browsers will.

    And of course, the entire URL including GET data like Juddling points out.

提交回复
热议问题