-1

How to redirect to another url on page refresh or page back using JavaScript or (any other easy alternatives );

Stephen Docy
  • 4,738
  • 7
  • 18
  • 31

2 Answers2

0

You can combine the page capture via something like a navigator object shown here:

https://stackoverflow.com/a/36444134/3187487

And then use window.location to redirect the person to where ever you want from there.

Gerik
  • 698
  • 3
  • 11
0

You can do something like this perhaps:

if (window.performance) {
  console.info("window.performance works");
}
  if (performance.navigation.type == 1) {
    window.location.href = "https://www.example.com"
  }

Ref1, Ref2

BlackBeard
  • 10,246
  • 7
  • 52
  • 62