Redirect faster with Greasemonkey (or a similar usercript mechanism)?

I use Greasemonkey to redirect specific URLs to another, but I would like to redirect before the URL is redirected.

I am currently using this simple script:

//==UserScript==
// @name Redirect Google
// @description Redirect Google to Yahoo!
// @include http://*.google.com/*
//==/UserScript==
window.location.replace("http://www.yahoo.com")

In the above example, Google appears for a second and then redirects to Google. I want to go to yahoo immediately. Is it possible, and how?

+3
source share
3 answers

You can use @run-at document-startthe Doc in the metadata block .
EG:

//==UserScript==
// @name Redirect Google
// @description Redirect Google to Yahoo!
// @include http://*.google.com/*
// @run-at document-start
//==/UserScript==
window.location.replace ("http://www.yahoo.com")


script , , .

+7

Greasemonkey . ( , ?)

, , , -, hosts.

(1) / ( Windows):

74.6.117.48 google.com
74.6.117.48 www.google.com

(2) . IE DNS (ipconfig /flushdns ).

(3) GM script.

(4) Google Yahoo.


, / . , ; , , ( ) - Greasemonkey script .

+2

Redirector Firefox - , Firefox Greasemonkey.

+1

Source: https://habr.com/ru/post/1781598/


All Articles