dcsimg
LinkedIn
Google+
Twitter
RSS Feed
Download our iPhone app
TODAY'S HEADLINES  |   ARTICLE ARCHIVE  |   FORUMS  |   TIP BANK
Browse DevX
Sign up for e-mail newsletters from DevX

By submitting your information, you agree that devx.com may send you DevX offers via email, phone and text message, as well as email offers about other products and services that DevX believes may be of interest to you. DevX will process your information in accordance with the Quinstreet Privacy Policy.


Tip of the Day
Language: Web
Expertise: Beginner
Mar 25, 2016

WEBINAR:

On-Demand

Building the Right Environment to Support AI, Machine Learning and Deep Learning


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.

Brad Jones
 
Comment and Contribute

 

 

 

 

 


(Maximum characters: 1200). You have 1200 characters left.

 

 

Sitemap
Thanks for your registration, follow us on our social networks to keep up-to-date