Avoid adding page to browser history when redirecting with http-equiv meta attribute

I have a webpage that redirects to the desired recipient url using:

<meta http-equiv="refresh" content="0; URL=$destination.url" />

I would like the first page not to be in browser history.

In particular, on mobile phones (Android, iOS, etc.), I want the back button to skip the redirect page.

+5
source share
2 answers

Your two options are either to use real HTTP redirection, or to use JavaScript location.replace.

The first is better, but if there is some reason, you cannot do this, it location.replacecan work as an alternative:

document.location.replace(redirectURL)

location.replace , "" . , - , , JavaScript.

+11

.

, HTTP. <meta> , .

+3

All Articles