This article mainly introduces how to use JavaScript to implement page redirection. It is the basic knowledge of getting started with JS. For more information, see
What is page redirection?
When you click a URL to access a Web page X, you are directed to another page Y internally, just because of page redirection. This concept is different from JavaScript page refreshing.
There may be various reasons why I want to redirect from the original page. The following are several reasons:
- If you do not like your domain name, you can redirect it to a new one. At the same time, we need to guide all visitors to the new website. In this case, you can retain the old domain name, but place it on a page to a page redirection so that all the old domain name visitors can come to the new domain name.
- The browser-based version or page with different names can also be redirected to the corresponding page by using the client page instead of the server webpage.
- The search engine may have included a new page. However, when you move to another domain name, you do not like to lose the visitor through the search engine. Therefore, you can use client page redirection. Keep in mind that this should not be done to make search engines dumb. Otherwise, the website may be banned.
How does the page work again?
Example 1:
This is very simple to use JavaScript redirection on the client page. To redirect a visitor to a new page, add a line in the head section as follows: