Search code examples
javascriptfirefoxgreasemonkey

Can I write a private greasemonkey script?


I want to write a greasemonkey script for my client to automate his tasks, however I don't want to share the script with others (as obviously, my client would not be too happy with this!)

How can I do write a greasemonkey script without sharing it with others?


Solution

  • The question is not clear. But if you mean, "Can I stop my client from seeing the Greasemonkey script's code and possibly sharing it?"

    Then the answer is "NO". Anyone using Firefox can see/edit the script's code via the Greasemonkey menu or the User Scripts tab in the Add-on manager.

    This is by design. The producers of Greasemonkey (and most script authors) do not want any possibility of hidden or encrypted scripts being foisted on unsuspecting users.

    ~~~
    Additionally, the script source can be seen by anyone with access to the client-machine's file system.



    If you mean:

    How can I run/install the script in my browser without uploading it to the userscripts site?

    That's easy...

    1. Save your script to to a file, EG MyScript.user.js. Keep track of where you saved it, and make sure it's not in a system temp folder.
    2. In Firefox, choose Open File (CtrlO).
    3. Navigate to where you'd saved your script and open it.
    4. Greasemonkey will pop up a dialog asking if you want to install the script. Press Install.


    See "Installing Scripts" in the documentation.