Clear history before manual redirects.

Clear out the latest history entry by setting a one time ignore flag and then triggering history.back(). The popstate will execute and then promptly be ignored, removing the history entry.

Triggering this on redirect requests (if the URL matches), will solve the back button issues in Firefox that have arisen from 30x responses which can't be handled by SPF (such as a 301 to HTTPS).
Let's make this comment a little more explanatory, since 30x redirects in and of themselves aren't the problem.