Organizational Research By

Surprising Reserch Topic

What's the best way to automatically redirect someone to another webpage?


I've never learnt JavaScript, but I imagine this is quite a simple problem. Just wanted to know which method is most advised these days.


asked Apr 29, 2015 in JAVASCRIPT by rahulgii
0 votes
24 views



Related Hot Questions

2 Answers

0 votes
// use this to avoid redirects when a user clicks "back" in their browser
window.location.replace('http://somewhereelse.com');

// use this to redirect, a back button call will trigger the redirection again
window.location.href = "http://somewhereelse.com";

// given for completeness, essentially an alias to window.location.href
window.location = "http://somewhereelse.com";
answered Apr 29, 2015 by rahulgii
0 votes

window.location.replace('http://boostr.in');

// use this to redirect, a back button call will trigger the redirection again
window.location.href = "http://boostr.in";

// given for completeness, essentially an alias to window.location.href
window.location = "http://boostr.in";
answered Apr 29, 2015 by rahulgii

...