-2

Can anyone explain how to redirect a page to a specific URL upon the user clicked page refresh option . For example if the user is currently in the page http://xxxxxxx.com/something, upon page refresh it needs to be redirected to http://xxxxxxx.com

simbu
  • 1
  • 1
  • last resort: just put a `window.location = "http://xxxxxxx.com"` inside the template of `something` – marmeladze Aug 18 '17 at 13:35
  • 2
    Possible duplicate of [How to redirect to another webpage in JavaScript/jQuery?](https://stackoverflow.com/questions/503093/how-to-redirect-to-another-webpage-in-javascript-jquery) – Jon Sampson Aug 18 '17 at 13:36

1 Answers1

0
<body onLoad="myRedirectFunction()">
</body>
<script>
myRedirectFunction() {
 window.location.assign("http://myRedirectLocation.com"); 
}
</script>
  • Above one automatically redirects the page to http://myRedirectLocation.com upon loading. i want the page to be directed only when the user manually clicks the refresh option – simbu Aug 18 '17 at 13:58