Instead of \"installing\" User-Scripts I found many tutorials on the web to add it manually. All of them told me to do the same steps:
- Make the directory C:\\Users\\Blabla\\AppData\\Local\\Google\\Chrome\\User Data\\Default\\User Scripts
- Place a .js file there, which contains the User-Script
- Start Chrome with the parameter --enable-user-scripts
I did so - but my demo script does not do anything:
// ==UserScript==
// @name Test
// @description Test
// @include http://example.com/*
// @version 1.0
// ==/UserScript==
alert(0);
What am I doing wrong?
The best thing to do is to install the Tampermonkey extension.
This will allow you to easily install Greasemonkey scripts, and to easily manage them. Also it makes it easier to install userscripts directly from sites like OpenUserJS, MonkeyGuts, etc.
Finally, it unlocks most all of the GM functionality that you don\'t get by installing a GM script directly with Chrome. That is, more of what GM on Firefox can do, is available with Tampermonkey.
But, if you really want to install a GM script directly, it\'s easy a right pain on Chrome these days...
Chrome After about August, 2014:
You can still drag a file to the extensions page and it will work... Until you restart Chrome. Then it will be permanently disabled. See Continuing to \"protect\" Chrome users from malicious extensions for more information. Again, Tampermonkey is the smart way to go. (Or switch browsers altogether to Opera or Firefox.)
Chrome 21+ :
Chrome is changing the way extensions are installed. Userscripts are pared-down extensions on Chrome but. Starting in Chrome 21, link-click behavior is disabled for userscripts. To install a user script, drag the **.user.js* file into the Extensions page (chrome://extensions
in the address input).
Older Chrome versions:
Merely drag your **.user.js* files into any Chrome window. Or click on any Greasemonkey script-link.
You\'ll get an installation warning:
Click Continue.
You\'ll get a confirmation dialog:
Click Add.
Notes:
- Scripts installed this way have limitations compared to a Greasemonkey (Firefox) script or a Tampermonkey script. See Cross-browser user-scripting, Chrome section.
Controlling the Script and name:
By default, Chrome installs scripts in the Extensions folder1, full of cryptic names and version numbers. And, if you try to manually add a script under this folder tree, it will be wiped the next time Chrome restarts.
To control the directories and filenames to something more meaningful, you can:
Create a directory that\'s convenient to you, and not where Chrome normally looks for extensions. For example, Create: C:\\MyChromeScripts\\
.
For each script create its own subdirectory. For example, HelloWorld
.
In that subdirectory, create or copy the script file. For example, Save this question\'s code as: HelloWorld.user.js
.
You must also create a manifest file in that subdirectory, it must be named: manifest.json
.
For our example, it should contain:
{
\"manifest_version\": 2,
\"content_scripts\": [ {
\"exclude_globs\": [ ],
\"include_globs\": [ \"*\" ],
\"js\": [ \"HelloWorld.user.js\" ],
\"matches\": [ \"https://stackoverflow.com/*\",
\"https://stackoverflow.com/*\"
],
\"run_at\": \"document_end\"
} ],
\"converted_from_user_script\": true,
\"description\": \"My first sensibly named script!\",
\"name\": \"Hello World\",
\"version\": \"1\"
}
The manifest.json
file is automatically generated from the meta-block by Chrome, when an user script is installed. The values of @include
and @exclude
meta-rules are stored in include_globs
and exclude_globs
, @match
(recommended) is stored in the matches
list. \"converted_from_user_script\": true
is required if you want to use any of the supported GM_*
methods.
Now, in Chrome\'s Extension manager (URL = chrome://extensions/), Expand \"Developer mode\".
Click the Load unpacked extension... button.
For the folder, paste in the folder for your script, In this example it is: C:\\MyChromeScripts\\HelloWorld
.
Your script is now installed, and operational!
If you make any changes to the script source, hit the Reload link for them to take effect:
1 The folder defaults to:
Windows XP:
Chrome : %AppData%\\..\\Local Settings\\Application Data\\Google\\Chrome\\User Data\\Default\\Extensions\\
Chromium: %AppData%\\..\\Local Settings\\Application Data\\Chromium\\User Data\\Default\\Extensions\\
Windows Vista/7/8:
Chrome : %LocalAppData%\\Google\\Chrome\\User Data\\Default\\Extensions\\
Chromium: %LocalAppData%\\Chromium\\User Data\\Default\\Extensions\\
Linux:
Chrome : ~/.config/google-chrome/Default/Extensions/
Chromium: ~/.config/chromium/Default/Extensions/
Mac OS X:
Chrome : ~/Library/Application Support/Google/Chrome/Default/Extensions/
Chromium: ~/Library/Application Support/Chromium/Default/Extensions/
Although you can change it by running Chrome with the --user-data-dir=
option.
Update 2016: seems to be working again.
Update August 2014: No longer works as of recent Chrome versions.
Yeah, the new state of affairs sucks. Fortunately it\'s not so hard as the other answers imply.
- Browse in Chrome to
chrome://extensions
- Drag the
.user.js
file into that page.
Voila. You can also drag files from the downloads footer bar to the extensions tab.
Chrome will automatically create a manifest.json
file in the extensions directory that Brock documented.
<3 Freedom.
This parameter is is working for me:
--enable-easy-off-store-extension-install
Do the following:
- Right click on your \"Chrome\" icon.
- Choose properties
- At the end of your target line, place these parameters:
--enable-easy-off-store-extension-install
- It should look like:
chrome.exe --enable-easy-off-store-extension-install
- Start Chrome by double-clicking on the icon
Share and install userscript with one-click
To make auto-install (but mannually confirm), You can make gist (gist.github.com) with <filename>.user.js
filename to get on-click installation when you click on Raw and get this page:
How to do this ?
Name your gist <filename>.user.js
, write your code and click on \"Create\".
In the gist page, click on Raw to get installation page (first screen).
Check the code and install it.