Closed emxsys closed 4 years ago
The trick is to keep track of the number of times POST was called on Manage Caller form. Then, instead of setting window.location.href
which corrupted the history, we unwind the history like this:
<script>
// Go back to the original referrer
$('#back-button').on('click', function (event) {
if (document.referrer == window.location.href) {
// Don't go back to self after a POST, instead, we unwind
// the history sufficently to go back to the original referrer
history.go({{ post_count }} * -2)
} else {
history.back()
}
});
</script>
A Back button is need to return the user to the original referrer, e.g, the dashboard. If the user invokes the Change button, the back history returns the user to the Manage Caller page. Perhaps a
cookie
is needed.Perhapse Manage Caller should be a modal dialog. Not sure how the page routing would work for that.