function initRedirect() {
window.location = "jswelcome.html";
return false;
}
If this function is called, then it sets
window.location (the page displayed in the browser) to a new page. The
return false says to stop processing the user's click, so the
href page doesn't get loaded.
What's so cool about this is that we've done a redirection without users having any idea that it happened. They're just on one of two different pages, depending on what they came in with. If they have JavaScript, they end up on a page shown in
Figure 2.8.