-1

I am trying to build a website that has an exit button. Once the exit button is clicked, I need to navigate away from my current page to Google AND I need it so that my back button can't be pressed to find my webpage. How would I do this using Javascript?

Matt B.
  • 191
  • 1
  • 10

1 Answers1

1

You can use this piece of code to prevent going back:

window.onbeforeunload = () => { return "You cannot propagate back."; };

Ziad Ali
  • 56
  • 5