Using JavaScript to Redirect to a New Page

When a person comes to a page, it is actually possible to redirect them to a new page. Because someone might have bookmarked the page, you can use this when you want to remove a page from your site so that you can avoid sending the person to a 404 error page.

window.location = "http://www.devx.com"; 

This page will be gone in a blink of the eye because of the script redirect!

Looking at the code, you’ll see that the window location is changed to www.devx.com. You could change this to any other site as well. The one downfall with this redirect is that if scripting is turned off, it won’t work.

Share the Post:
Share on facebook
Share on twitter
Share on linkedin

Related Posts