<< Home

Redirect to another page using javascript

A URL redirect is created using javascript when you want to redirect the visitor to another page on the web. This would be used if you want to move from one domain to another. For example, if you previously owned www.flowers-in-england-forcheap-because-we-couldnt-find-another-name.co.uk and wanted to rebrand to www.cheapflowers.co.uk you can redirect the old site to the newly branded site.

If you click the link below we go to another page. If we enter the correct password then that page will load. If we enter an incorrect password then we will redirect to another page that will allow you to come back here and try again. Try out the example using both the correct and incorrect password. The redirect code that is placed in the head of the page that the link below goes to is shown in the screenshot below.

Go to page with redirect code

For the assignment you need to explain what a redirect is and how it can be used. It would be excellent to produce and example to show that you understand.