How To Make A Link With A Transition To A Link

Table of contents:

How To Make A Link With A Transition To A Link
How To Make A Link With A Transition To A Link

Video: How To Make A Link With A Transition To A Link

Video: How To Make A Link With A Transition To A Link
Video: How to create a hyperlink and rename it 2024, May
Anonim

Sometimes it becomes necessary to automatically redirect a site visitor from one page to another in "automatic mode". That is, just went in and immediately without questions or pressing anything - please go to another page. For example, the site has moved, but visitors are still visiting the old address. Of course, superpros do this kind of redirect at the level of additional web server configuration files (htaccess) or server scripts. But a growing number of Internet residents acquire their own websites and manage them perfectly without the mediation of superphies. Fortunately, the principle "to everyone who wants to - according to the site" is implemented in the network without any national projects and mortgages. So how can a layman implement automatic redirection of a visitor to a given link?

Automatic link following
Automatic link following

Instructions

Step 1

There are two simplest redirect options that require nothing more than the ability to make the appropriate changes to the desired page. The first solves the problem by means of HTML (HyperText Markup Language - "hypertext markup language"). This is the language in which the Internet pages are written. This language has the tag we need - a command that tells the browser to which address and after how many seconds the page visitor needs to be sent. It looks like this:

Here, the number "10" indicates how many seconds you need to wait - for example, so that the visitor has time to read the message that the site has moved. And the address https://www.kakprosto.ru/ gives the browser the URL where the visitor should be sent. This tag must be inserted in the "page title" - the area of html code that starts with a tag and ends with a tag.

Step 2

The second redirect method uses the capabilities of the JavaScript language. To use it, you need to enter the appropriate commands in the html-code of the page. First, you need to tell the browser that the JavaScript script starts at this point. In JavaScript, this opening tag looks like this:

And the closing one is like this:

Between these two tags are instructions - language operators. The redirection effect we need can be achieved by several of them:

window.location.reload ("https://www.kakprosto.ru/");

or

document.location.replace ("https://www.kakprosto.ru/");

or

document.location.href = "/";

The complete script code will look like this:

document.location.href = "/";

This script can also be inserted into the same heading area of the html-code - between the and tags. Although not required, you can insert it into the main body of the page, that is, between the and tags.

Recommended: