Lessons

Redirecting JavaScript code

Redirection is a situation where a page itself initiates a transition to another page, like a user clicking on a link with a mouse.

They are used, for example, to change the connection from HTTP to secure HTTPS. Or from a domain with the prefix “www” to a page without one.

It is better to do redirects through the Location header, rather than JavaScript code, since in the first case it happens much faster. In the second case, the page loads completely, and the user spends more time redirecting.

List of functions that redirect the user or refresh the page:

/*Страницу обновляют следующие функции*/
location.reload();
history.back();
history.forward();
history.go(0);
location.replace("https://example.com");
location.href = "https://example.com";
location.assign("https://example.com");

/*Так же страницу можно обновить через симуляцию клика по ссылке.*/
var a = document.createElement('a');
a.href = "https://example.com";
a.click();

/*Бывают код специально подготавливается таким образом, чтобы его невозможно было найти через текстовый поиск по названию функции.*/
location["reload"]();
location["r"+"e"+"l"+"o"+"a"+"d"]();
eval('location.r'+'e'+'l'+'o'+'a'+'d();');
/*В таком поиск кода, обновляющую страницу может затянуться.*/

PRO subscription for working with the service

Promo
Checking 50 pages in the tool "Checking the page"
190 ₽
The subscription is activated for 10 days and is linked to a specific site.
PRO subscription
3,500 pages per week in tools "Checking the page" and "Full site scan".
1 580 ₽
The subscription is activated for 30 days and you can scan any site.
Wallet
Additional pages that are credited to a separate balance. For checking large sites.
200 ₽
Number of pages
An active PRO subscription is required.
We use cookies. By continuing to use the site, you agree to the processing of personal data in accordance with privacy policy. I agree