Skip to content

What should happen with location.reload() on a page that is a POST result? #3215

Closed

Description

@bzbarsky

Consider this testcase:

<form action="/?url=https%3A%2F%2Fsoftware.hixie.ch%2Futilities%2Fcgi%2Ftest-tools%2Fecho" method=post>
  <input type="submit" name="something" value="Submit me">
</form>
  1. Load the testcase.
  2. Click the button.
  3. Open developer tools and evaluate "location.reload()".

I can't do step 3 in Safari, because it won't let me open developer tools on that page. But in Chrome, Firefox, and Edge, in step 3 the reload resends the POST data. Firefox and Edge prompt for the repost; Chrome just silently does it.

If I read the spec right, we're in https://html.spec.whatwg.org/multipage/history.html#dom-location-reload in the "Otherwise" case, which just says to navigate to the document's URL, ignoring any POST data, which doesn't match the above-described browser behavior.

Activity

  1. bzbarsky commented on Nov 8, 2017

    @bzbarsky
    ContributorAuthor
  2. annevk commented on Nov 9, 2017

    @annevk
    Member

    I wonder how @mcmanus feels about removing the prompting. As I understand it servers already need to be resilient against duplicate POSTs due to various protocol issues. Given that, it seems unfortunate to have a dialog the user isn't really helped with (or can typically make sense of).

  3. bzbarsky commented on Nov 9, 2017

    @bzbarsky
    ContributorAuthor

    The prompting is a separate issue. This issue is about the server-observable behavior: does the POST get resent at all?

  4. annevk commented on Nov 9, 2017

    @annevk
    Member

    Understood and we should fix that, but I'm wondering if the new language (and tests) needs to account for the prompting or not.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions