history.go(-1)
I need to do this because I have a comments block embedded in non-MT pages and I have no way of knowing exactly where comments are submitted from.
I tried this in Comments.pm but its not doing the trick:
CODE
sub do_red {
my $app = shift;
my $q = $app->{query};
my $id = $q->param('id') or return $app->error("No id");
my $comment = MT::Comment->load($id)
or return $app->error("No such comment");
my $uri = encode_html($comment->url);
return <<HTML;
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01//EN" "http://www.w3.org/TR/html4/strict.dtd">
<html><head><title>Redirecting...</title>
<meta name="robots" content="noindex, nofollow">
<script type="text/javascript">
window.onload = history.go(-1);
</script></head>
<body>
<p><a href="#" onclick="history.go(-1)">Click here</a> if you are not redirected</p>
</body>
</html>
HTML
}
my $app = shift;
my $q = $app->{query};
my $id = $q->param('id') or return $app->error("No id");
my $comment = MT::Comment->load($id)
or return $app->error("No such comment");
my $uri = encode_html($comment->url);
return <<HTML;
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01//EN" "http://www.w3.org/TR/html4/strict.dtd">
<html><head><title>Redirecting...</title>
<meta name="robots" content="noindex, nofollow">
<script type="text/javascript">
window.onload = history.go(-1);
</script></head>
<body>
<p><a href="#" onclick="history.go(-1)">Click here</a> if you are not redirected</p>
</body>
</html>
HTML
}
... But I am still getting sent to the URL I specify in the "static" tag in the template.. why? I can't figure out when Comments.pm spits out the HTML above.