Z
Z
Zikrillo Abbosov2020-04-23 16:31:46
PHP
Zikrillo Abbosov, 2020-04-23 16:31:46

How to prevent the return to the old one after sending the data?

Friends, such a problem has arisen here, I need to prohibit the user from returning to the previous page. I say in advance that the code

history.pushState(null, null, location.href);
window.onpopstate = function(event) {
history.go(1);
};
Does not work normally, after refreshing the page again allows you to go back.
To make the back button disappear (preferably in PHP)

Answer the question

In order to leave comments, you need to log in

3 answer(s)
D
Dmitry Gordinskiy, 2020-04-23
@DmitriyGordinskiy

mdn

There is no way to clear the session history or to disable the back/forward navigation from unprivileged code.

Is it possible to open the link in a new tab and close the current one)

A
AUser0, 2020-04-23
@AUser0

Make the return just pointless. For example, a one-time key. The first visit to the page - there is a key, everything is done as standard, but it is erased. Repeated handling of the same key results in an error, because it has already been erased.
Everything else is an elegant attempt to hide behind a mop.

K
Karpion, 2020-04-23
@Karpion

What for? From the reason for the ban - and we dance.

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question