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
To prepare a commercial offer.
190 ₽
50 pages for 10 days
  • 1 page gives 1 tool launch Checking the page.
  • Purchased for a specific site
  • Restrictions on other tools remain the same
PRO subscription
For regular work on a site or a group of sites.
1 580 ₽
3,500 pages per week. The subscription period is 1 month.
Wallet
A separate page balance that complements the PRO subscription balance.
190 ₽
Number of pages
  • An active PRO subscription is required to use the wallet balance
We use cookies. By continuing to use the site, you agree to the processing of personal data in accordance with privacy policy. I agree