First option using href
Event.observe(window, ‘load’, function() {
window.location.href = “http://stackoverflow.com”;
});
However a better way is to use replace method.
Event.observe(window, ‘load’, function() {
window.location.replace(“http://www.google.co.uk”);
});
“because replace() does not put the originating page in the session history, meaning the user won’t get stuck in a never-ending back-button fiasco. If you want to simulate someone clicking on a link, use location.href. If you want to simulate an HTTP redirect, use location.replace.” http://stackoverflow.com/a/506004