[Greasemonkey] gm addedd javascript would work without it?
Jeremy Dunck
jdunck at gmail.com
Thu Jun 29 09:29:32 EDT 2006
On 6/29/06, carlos campderrós <gilipollas.desconcertante at gmail.com> wrote:
> To Jeremy:
>
> If I'm right, you say I should do this test and, if correct, add the
> form generation and the function declaration inside.
>
> Thanks everyone
Tweaked so it actually works. ;-)
============
alert('injecting.');
unsafeWindow.location.href = 'javascript:var mytestvar=1;';
if (unsafeWindow.mytestvar) { //js enabled, continue.
alert('i do declare!');
}
alert('done');
============
The code inside the branch will only run if the user script was
successful in setting a variable in the page context -using the page
context-.
This is different than just
unsafeWindow.mytestvar = 1
because that approach uses the chrome context's js engine, which would
succeed despite whether page scripts were enabled.
I tested this with GM and NoScript, injecting on google.com.
More information about the Greasemonkey
mailing list