27

Today Google changed the way userscripts are installed in Chrome. No longer can you just click on a link that contains one, confirm a couple dialog boxes and have it installed. Now you have to download the script with Save As..., open the Finder/Explorer window that contains it, open the Extensions window in Chrome, then drag the script to the extensions window. IOW, a big PITA.

Presumably the alternative is to package as a Chrome extension and get it on the Chrome webstore. However, I can't find any information anywhere that suggests you can package a userscript as an extension. Is this possible? If yes, any new limitations, links to docs, or other tips?

mix
  • 6,943
  • 15
  • 61
  • 90
  • 21.0.1180.41 beta. Not sure why I'm on a beta, but it auto-updated to this version. Apparently the change has been in the dev pipeline for a while and is headed for release. You can bypass the new behavior by running chrome w/ --enable-easy-off-store-extension-install, but that's not an end-user solution. Unfortunately the browser that was the easiest to install userscripts just became a lot more difficult. – mix Jul 14 '12 at 05:09
  • and unfortunately the new method (drag/drop) doesn't work on the current release versions, so once the drag/drop goes live in release, there will be two methods of install required by users for a bit – mix Jul 14 '12 at 05:17

2 Answers2

27

Two things first:

  1. This new behavior of Chrome seems too restricting and draconian for userscripts. If you agree, please make your displeasure known to Google. (Userscripts are not quite as dangerous, or powerful, as full-fledged extensions.)

  2. Rather than trying to package extensions (which seems like a low benefit-to-hassle activity), Chrome provides two mechanisms to (selectively) disable this new annoyance:

    1. Configure Chrome to start with the --enable-easy-off-store-extension-install parameter.

    2. Add configuration keys to allow installations from specific sites:
      For example, add this entry to the Windows registry:

      Software\Policies\Google\Chrome\ExtensionInstallSources\1 = "http://userscripts.org/*"
      

      To allow easy installation from that useful script clearinghouse.



Packaging a userscript as an extension (Verified on the latest release, version 20.0.1132.57 and subject to change):

  1. Create a script folder and a manifest for your userscript, as in the "Controlling the Script and name" section of this answer.

  2. From the Chrome Extensions page, activate Developer mode: dev mode

  3. Click Pack Extension. pack extension

  4. Enter the folder path, created in step 1, and click Pack Extension: pack ext, enter fields

  5. Note that the new extension file (HelloWorld.crx) and key file (HelloWorld.pem) are created in the parent directory (C:\MyChromeScripts\). pack results

  6. Now the extension can be installed like any other, or uploaded to the Chrome Web Store.

Community
  • 1
  • 1
Brock Adams
  • 90,639
  • 22
  • 233
  • 295
  • agreed on this being too restrictive. they should at least offer an option to disable the restriction. the workarounds you mention are great for devs, but non-workable for end users. i've gotten a test extension to work as you outlined, but am worried about whether Google will allow/keep it in the Chrome webstore. the script I'm working on mucks with Facebook, and I don't want it getting shut down by Google just because Facebook says they don't like it. i'll try and read up on their rules. the extension route would be the best option from the user's perspective if I can trust it. – mix Jul 14 '12 at 06:46
  • 1
    Don't discount the Tampermonkey approach. If Tampermonkey is not affected by this new annoyance, it's better -- in some ways -- than straight userscripts, anyway. (Note that I avoid Chrome beta releases, so I don't know if Tampermonkey is affected. It shouldn't be, and will certainly engineer a workaround, if it is.) – Brock Adams Jul 14 '12 at 07:09
  • tapermonkey works in the beta, but it's not a great install experience for the non-techie. it flashes the screen on clicking the userscript link, brings up some cryptic dialogs (e.g. with the title 'The page at chrome-extension://dhdgffkkebhmkfjojejmpbldmpobfkfo says:'), and then leaves the user on a screen of code when finished. – mix Jul 14 '12 at 07:35
  • @BrockAdams FWIW, Tampermonkey still works fine in Chrome 26. – Marnen Laibow-Koser Apr 14 '13 at 02:25
7

You could use a Chrome extension like Tampermonkey to run/manage your userscripts without having to install them as extensions themselves.

(I've never used it so I can't say if it's any good, it's reviewed well though)

Jason Hall
  • 20,632
  • 4
  • 50
  • 57
  • 1
    It's actually possible to synchronize Greasemonkey scripts using Tampermonkey, so I prefer to use TamperMonkey: http://forum.tampermonkey.net/viewtopic.php?f=26&t=414 – Anderson Green Jan 30 '13 at 19:13