Frans wrote on Mar 10, 2021, 02:48:
RedEye9 wrote on Mar 8, 2021, 14:25:That's because the browser already went through one redirect inside the scripts, so the Referer path of the original request is no longer available. Changing that would require something like passing that path in a &url= parameter throughout the login process, which looks fugly and is cumbersome in the code.
"Return To Previous Page" does not appear after logging in on a news post that has zero comments.
After posting this, I had a tiny spark of an idea I could look into only now, and I've made a small improvement:
From a thread page with 1+ comments (board.pl?action=viewthread), clicking the Post/Reply/Quote buttons when not logged in redirects to the log-in form, where that thread link is stored as Referer in a hidden field. That's why after logging in, it can be presented in the Return button below the user menu.
When a story has no comments, after clicking "Post a Comment" from the front-page and logging in, the Referer is the front-page. Thus the code doesn't enable the Return button: that's a little pointless as the site logo already provides that link back.
But from a Share / single-story link (/s/#####/...) clicking "Post a Comment" does contain a meaningful Referer, so I've now updated the log-in code to show a Return button in that case too.
As mentioned before, a Referer from the post form (board.pl?action=postmessage) is not available because that redirect happens internally in the script without a new browser request. That's why a direct return to the post form cannot be done hassle-free.