The code in the question works fine. Verified with Greasemonkey 1.5 and Firefox 16 and 17 on Windows XP and Windows 7.
Re:
Argh, now im being told GM_setValue doesnt exist. I didn't think it was a choice between GM_ functions and jQuery functionality
You don't have to choose. Don't inject jQuery (or most other libraries) use @require
. Then, with the proper @grant
directives, you can use GM_
functions easily.
There is no point in code like this.$ = this.jQuery = jQuery.noConflict(true);
unless you use @grant none
-- which would shut off GM_
functions.
$(document).ready()
is not needed in a Greasemonkey script unless you use @run-at document-start
.
So, use code like this:
// ==UserScript==
// @name YOUR_SCRIPT_NAME
// @include http://YOUR_SERVER.COM/YOUR_PATH/*
// @require http://ajax.googleapis.com/ajax/libs/jquery/1.7.2/jquery.min.js
// @grant GM_getValue
// @grant GM_setValue
// @grant etc., etc.
// ==/UserScript==
$.get ('index.php', function () {
console.log ('yay');
console.log ($(this).html () );
} );