redirect.js 405 B

123456789101112131415
  1. function redirect(redirectURL, time = 1000) {
  2. try {
  3. setTimeout(function () {
  4. window.location.replace(redirectURL);
  5. }, time);
  6. }
  7. catch (err) {
  8. try {
  9. window.location.href = redirectURL;
  10. }
  11. catch (err2) {
  12. window.alert(`Couldn't automatically redirect - Please visit this link manually: ${redirectURL}`);
  13. }
  14. }
  15. }