20

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== 
Brock Adams
  • 90,639
  • 22
  • 233
  • 295
Scripter
  • 558
  • 2
  • 8
  • 20

2 Answers2

23

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');
Brock Adams
  • 90,639
  • 22
  • 233
  • 295
  • when you say don't use include you don't say what to use. did you mean to use match instead include? – m3nda Jan 18 '15 at 08:06
  • @erm3nda, I said don't use `@include *`. That `*` makes a big difference. Yes, it's good to use `@match`, or you can use something like `@include  http://YOUR_SERVER.COM/YOUR_PATH/*` – Brock Adams Jan 18 '15 at 10:02
  • Oh, you say `@include *` LITERALLY. You're right, that's the really wrong way. – m3nda Jan 19 '15 at 06:11
1

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

  • HTPS is required only if the `Require secure updates` option is checked. (Yes, it is checked by default on new Greasemonkey installations.) Also note that it was proved that the metadata block *was* faulty in the `*.meta.js` file. So that part of this answer is wrong. – Brock Adams Jul 27 '14 at 00:31