For this test Greasemonkey UserScript, the alerts pop up but nothing is logged to the Firebug console.
This is with Greasemonkey 0.9.18 and Firebug 1.9.1 in Firefox 12.0.
// ==UserScript==
// @name test
// @namespace tester12354
// @include *
// @require http://code.jquery.com/jquery-latest.min.js
// ==/UserScript==
(function($) {
$.fn.tester1 = function(test) {
alert(test);
console.log(test);
}
}(jQuery));
$.extend({
tester2: function(test) {
alert(test);
console.log(test);
}
});
alert($().jquery)
console.log($().jquery)
$().tester1('from tester1');
$.tester2('from tester2');
As it is explained in the GreaseMonkey manual, in GreaseMonkey scripts, the global context for the script is not the Browser’s real window object (unlike in actual scripts that execute on the page) but a dummy version of the window object with the same APIs.
The
consoleobject is a global variable on the real window and is thus not accessible from GreaseMonkey (or at least from jQuery on GreaseMonkey).See this page for explanation on what’s up with
consoleunder GreaseMonkey and how you should log messages from GreaseMonkey.