Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Why isn't my Greasemonkey script updating?

I've got a Greasemonkey script for Firefox. The script includes this meta-block and some lines of code.

I want to update my script on the server and then automatically update the browser's scripts. The requireSecureUpdates option is off.
What am I doing wrong?

My 1.meta.js

// ==UserScript== 
// @name     Ibood autosubmit 
// @include  https://*.ibood.com/* 
// @include  http://*.ibood.com/* 
// @include  * 
// @version  1.1 
// @require  http://ajax.googleapis.com/ajax/libs/jquery/1.7.2/jquery.min.js 
// @grant    GM_addStyle 
// @downloadURL http://www.tipsvoorbesparen.nl/1.user.js
// @updateURL http://www.tipsvoorbesparen.nl/1.meta.js
// ==/UserScript== 
like image 230
Scripter Avatar asked Feb 26 '13 17:02

Scripter


People also ask

Is Tampermonkey or Greasemonkey better?

Tampermonkey is more recent than Greasemonkey and supports all the major browsers. Furthermore, Tampermonkey is fairly easy to use for both beginners and advanced users. It's easier to install scripts on Greasemonkey but Tampermonkey's features like code checking help you be more accurate.

How do I check my Greasemonkey scripts?

To access Greasemonkey's management pane, click on the downward arrow on the right side of the button Greasemonkey to the right of your URL bar and select Manage User Scripts. This opens a tab with a list of your scripts.

Can Tampermonkey scripts steal passwords?

Yes, userscripts can steal your passwords. That's the bottom line.


2 Answers

Two problems:

  1. Currently, your 1.meta.js is:

        // ==UserScript== 
        // @name     Ibood autosubmit 
        // @include  https://*.ibood.com/* 
        // @include  http://*.ibood.com/* 
        // @include  * 
        // @version  1.7
        // @require  http://ajax.googleapis.com/ajax/libs/jquery/1.7.2/jquery.min.js 
        // @grant    GM_addStyle 
        // @downloadURL http://www.tipsvoorbesparen.nl/1.user.js
        // @updateURL http://www.tipsvoorbesparen.nl/1.meta.js
        // ==/UserScript== 
    

    Note the leading spaces?

    Greasemonkey cannot handle leading spaces for its Metadata Block due to a design limitation1.

  2. The current script version seems to be 1.8, but the meta file has version 1.7.

~~~~~
For small scripts, that you host on your own website, don't even bother with the @updateURL setting. That's there mainly to conserve bandwidth, especially on sites like userscripts.org.

With no @updateURL setting, Greasemonkey will just use/check whatever's set by @downloadURL. This saves you extra maintenance work (and possible SNAFU's like this one).

Finally, on an unrelated note, don't use @include *!
Using @include *:

  1. Slows down your browser
  2. Can cause unwanted side effects
  3. Causes conscientious users to refuse to install your script.





1. Specifically, this bit in the GM source file, parseScript.js:

var gAllMetaRegexp = new RegExp(
    '^// ==UserScript==([\\s\\S]*?)^// ==/UserScript==', 'm');
like image 91
Brock Adams Avatar answered Oct 11 '22 04:10

Brock Adams


If the script is working, then there's not likely a problem with your meta block, EXCEPT, you need to use a valid HTTPS source to enable updating.

Reference http://wiki.greasespot.net/Metadata_Block#.40downloadURL

like image 38
user1781495 Avatar answered Oct 11 '22 04:10

user1781495