Redirect a Web page to a different Web page
I know of two different methods to do this. One uses just HTML commands and the other uses a small Javascript program. I recommend the HTML method.
| HTML method | Javascript method |
| Further info HTML method | Further info Javascript method |
Original page: <examplehtml.htm>
Target page: <http://www.austincc.edu/mparker/prereqm/redir.htm>
Watch it work: To see how redirecting works, go to my web page examplehtml.htm and see that you do get transferred to the target page after 2 seconds. (You can change the time delay.)
How to do it: The file here shows the HTML code it takes to accomplish this. Notice both places to put the target address. You put exactly this HTML code into your file. Then, when a person calls up your file, they are automatically redirected to the target page. In this example, the redirection occurs after 2 seconds. If you want to delay it five seconds, make the line that starts with <META include the entry CONTENT="5 rather than the 2 that is now there. If you want to put more text in the body of the page, that is OK. However, you should make the delay time longer as you add more text because the viewers will be very frustrated when the page goes away after 2 seconds if it would take them 5 seconds to read all the text on the page!
Return to the
top of this document.Original page: <example.htm>
Target page: <http://www.austincc.edu/mparker/prereqm/redir.htm>
Watch it work: To see how redirecting works, go to my web page example.htm and see that you do get transferred very quickly to the target page with the colorful background. You'll have to watch quickly to see the URL for example.htm.
If you want to see it a little better, go to the URL line and actually type in the URL http://www.austincc.edu/mparker/hints/example.htm
Then hit enter and see what happens. It should transfer you to the target page.
How to do it: The file here shows you the HTML code it takes to accomplish this. Notice where to put the target address. You put exactly this HTML code into your file. Then, when a person calls up your file, they are automatically redirected to the target page.
Return to the
top of this document.This HTML command is supported in HTML 3.2 and later, which any current browser should support. If a browser that only supports older versions of HTML is used, then it should just ignore that command and show the page. Then a viewer could click on the link on the page and go to the new page.
Why don't I make it transfer after 0 seconds? I could. However, then the "Back" button on the viewer's browser won't work, because when it goes back, it hits the transfer page and goes forward again. This is called "breaking the Back button" and is considered very bad in web design. Users get used to being able to go "Back" and get frustrated when it doesn't work.
Why don't I put more explanation on the page? If you put a lot of explanation and then the transfer happens fast that is frustrating for the viewer because they see that the page has text they are unable to read before the page goes away. On the other hand, if you don't put any text on the page, then there is nothing to help the viewer whose browser doesn't execute the HTML command to redirect. My compromise here is to put a very short sentence as a link. People should be able to read it fast enough that it isn't frustrating. But if the redirect doesn't work, it's obvious that the viewer should click on it.
Return to the
top of this document.Further information: Javascript
Redirecting is done with a Javascript. Some older web browsers do not include support for Javascript. (I'm pretty sure that Netscape 1.x didn't. I know that Netscape 4.x and Internet Explorer 4.x and higher do. I believe that Netscape 3.x and IE 3.x do and am not sure about the 2.x in either.) I have not been able to try this on a variety of old browsers. I know that in some cases when the browser doesn't support Javascript, it simply shows the page but doesn't run the script. In those cases, the viewer could click on the only link on the page and go to the new page. Of course, without any explanation, they might not figure that out. I have also heard reports that, for some people who don't have Javascript installed in their browser, going to this page which tries to call the program to run Javascript crashes the browser instead of simply leaving the web page shown and not starting Javascript. That's certainly not good. This is why I don't recommending using the Javascript alternative.
If you want the "redirection" page to put a message in it that can be read if the redirection doesn't work, then look at this file and watch it work. I don't think this is great, because the viewers see some text that goes by too fast for them to read. However, if you make it very minimal text, as I did here, it shouldn't be too distracting. I have also heard reports that, for some people who don't have Javascript installed in their browser, going to this page which tries to call the program to run Javascript crashes the browser. That's certainly not good. This is why I don't recommending using the Javascript alternative.
Return to the
top of this document.Last updated September 7, 2000. Mary Parker