When voting on a node, the form uses the POST method. This is good. As a change is being made on the server in response to the HTTP Request, this is the right method to use according to the RFC.
However, this does introduce a niggle or two. Happily this should be easy to fix as I try to explain below.
If one wishes to refresh a node after voting on it (to see, for example, if there are any new replies) most browsers will warn the user that they are resubmitting POST data (also a good thing).
Additionally, since the request was made using POST, the URL the browser has visited doesn't include the node id. This makes it troublesome to bookmark the page, or copy/paste the URL to tell somebody else about the node.
However, this should be a pretty easy thing to fix (depending on how the modified Everything code that PM runs on is set out). Simply issue a 302 redirect back to the node page after making the changes on the server.
Such code might look something like this (untested):
use strict; use warnings; use Apache::Constants qw(:common REDIRECT); use Apache::Request; # Update. See said it was untested! sub handler { my $r = shift; $r = Apache::Request->instance($r) my $op = $r->param('op'); if (defined $op && $op eq 'vote') { # # Insert code to record votes here # my $node_id = $r->param('node_id') || ''; my $location = "http://" . $r->hostname . "/?node_id=$node_id"; $r->header_out('Location' => $location); return REDIRECT; } # Otherwise carry on and display the page as normal }
In reply to Redirect after post for happy bookmarking and refreshing by dorward
| For: | Use: | ||
| & | & | ||
| < | < | ||
| > | > | ||
| [ | [ | ||
| ] | ] |