Strelok
Strelok

Reputation: 11

Replace javascript on a site with Greasemonkey

does anyone know how to replace JavaScript on a site with Greasemonkey ie.

This is the default code:

var Test="1";

And i want to replace it like this on the page load:

var Test="2";

Thanks in advance!

Upvotes: 1

Views: 1525

Answers (1)

erikvold
erikvold

Reputation: 16508

Try the following in a userscript, assuming Test is a global variable:

unsafeWindow.Test="2";

Upvotes: 1

Related Questions