Harshil Sharma
Harshil Sharma

Reputation: 2035

Greasemonkey script not updating

I have a greasemonkey script with following meta block-

// ==UserScript==
// @name    TDF  Improved Dark Skin
// @namespace   TDF
// @include http://www.digit.in/forum/
// @copyright   harshilsharma63
// @author  harshilsharma63
// @author  harshilsharma63
// @downloadURL https://openuserjs.org/install/harshilsharma63/TDF_Improved_Dark_Skin.user.js
// @updateURL https://openuserjs.org/install/harshilsharma63/TDF_Improved_Dark_Skin.user.js
// @grant none
// @version 0.4
// ==/UserScript==

Even if I update the script on the server and increase the version (e.g. from 0.2 to 0.4), Greasemonkey doesn't update the installed script. Also, in Greasemonkey's user script management page in Firefox, the "find updates" and "forced find updates" are grayed out. What am I doing wrong?

Upvotes: 7

Views: 3084

Answers (3)

papo
papo

Reputation: 1959

The support for Keys @downloadURL and @updateURL was (temporary) removed in Greasemonkey 4.0 (first WebExtensions version).
Update feature based on the original download link still works.
You can't now manually add a script using "New user script..." in the GM menu and have it later updated using @downloadURL Key.
Specially annoying for scripts which are not named correctly: *.user.js, since you can't install them from the download location (which would save the URL inside the GM database and allows the update feature).

(workaround below)

This is the only notice about the missing feature I found:

Greasemonkey 4.0 was released with several features missing.
https://wiki.greasespot.net/Version_history#4.0_2

Today there are no mentions of either @downloadURL or @updateURL on https://wiki.greasespot.net
Though google will still show some cached results when searched for it.

You can observe the disappearance of @downloadURL and @updateURL Keys from the documentation on WayBackMachine:

October 27, 2017 Metadata Block description page contains update override Keys
December 26, 2017 Metadata Block description page does not contain update override Keys


Workaround

To edit or add the script URL used for updates.

  1. Using Greasemonkey menu, Export a backup...
  2. Open saved zip file and locate inside correct .gm.json file for the GM script you want to change the update URL.
  3. Edit property "downloadUrl" in the .gm.json file.
    3a. For manually added script the value is null (i.e. "downloadUrl":null), replace null with double-quoted URL (e.g. "downloadUrl":"https://server.com/scriptname.js").
    3b. The script URL does not need to contain .user.js when it's replaced this way.
  4. Update modified .gm.json file back to the back-upped zip file.
  5. Return it to the Greasemonkey using Greasemonkey menu, Import a backup...

Dirty Workaround 2

For scripts which are not named properly ending with *.user.js.

Clicking on a Greasemonkey script on a web page ("RAW" button on gist.github.com), should open the GM's Install dialog.
When a script name is not ending with *.user.js, the script code is instead showed in a browser.

Append ?script.user.js to the URI. (or &script.user.js, if ? is already present)
Tested with gist.github.com.

Upvotes: 1

sizzlemctwizzle
sizzlemctwizzle

Reputation: 61

You don't need to set @downloadURL or @updateURL to make sure your script updates. All the latest user script managers use a new method to check for updates if those values aren't present. But if you are going to set them at least use the meta url to conserve my bandwidth.

// @updateURL https://openuserjs.org/meta/harshilsharma63/TDF_Improved_Dark_Skin.meta.js

Source: I run OpenUserJS.org and implemented the initial version of the Greasemonkey updater.

Upvotes: 6

Brock Adams
Brock Adams

Reputation: 93473

This appears to be Greasemonkey Bug #1938. It should be fixed in the next release of Greasemonkey (Version 2.1).


Also, it never hurts to check that extensions.greasemonkey.enableUpdateChecking is not set to false in about:config. (The key may not be present for newer installations of GM+FF.)

Upvotes: 4

Related Questions