How to implement auto-update in a Greasemonkey script?
Asked Answered
C

1

8

I am writing a Greasemonkey script, how to implement auto updating?

Is possible put script into GitHub repository and set @version number?

And then... is some automatically way how to do it? Or I must manually check.

Cay answered 20/3, 2018 at 20:39 Comment(2)
What version of Greasemonkey are you using?Kweichow
Greasemonkey version 4.5.Cay
B
8

As of some time ago, Greasemonkey supports auto updates (it was not the case at the moment the question was asked):

  1. Add @updateURL to the script meta config. It can (but not necessary) be the same as @downloadURL.
  2. Add @version to meta. Each new script version should increment the value.
  3. Optionally, the file name should end with .user.js for GM to open the installation dialog.

Is possible put script into GitHub repository and set @version number?

The script can be hosted in GitHub repo or gist. The download and update URLs should link to the raw file, though. To install the script, user will have to open that @downloadURL. Here's the GM wiki page on the subject.

Barnet answered 6/5, 2018 at 4:6 Comment(2)
Thanks. This helped me also with tampermonkey.Sclerosed
Read what @updateURL and @downloadURL do and why in most cases they should not be used.Jovi

© 2022 - 2024 — McMap. All rights reserved.