Make site not appear in history (through code, not user)

Viewed 134

I'm creating a website for people who need help (getting abused and stuff). There is an 'escape' button on the site to switch to another site if someone wants to hide what they were looking for. But the visited page is still in the history of the browser.

Is there any way to make the site remove itself from browser history? Or does the user need to activate 'incognito' ?

3 Answers

location.replace SHOULD have done this

The Location.replace() method replaces the current resource with the one at the provided URL. The difference from the assign() method is that after using replace() the current page will not be saved in session History, meaning the user won't be able to use the back button to navigate to it.

try

This test

<button type="button" onclick="location.replace('https://safe.site.com')">Leave</button>

which will replace CURRENT page - so your site needs to be a single page application (SPA) OR every click on the page needs to do location replace too

But yes, suggest incognito

Related