Questions tagged [userscripts]

Use the Tampermonkey tag if running Tampermonkey or Violentmonkey, use the "Greasemonkey-4" tag if running that engine on Firefox. For all other engines, or multi-engine scripts, use the "Userscripts" tag. Userscripts primarily refers to JavaScript extensions for web browsers, used to automate or customize actions, the layout, or other aspects of the user experience.

Userscripts primarily refers to extensions for web browsers. Userscripts can automate or customize actions, and/or they can change the layout or even "mash up" different websites.

Userscripts are commonly installed in browsers using a userscript manager add-on/extension, but some browsers have limited native support.

On most browsers, when using a userscript manager, userscripts have access to an extended API that allows some actions that are not permitted for ordinary JavaScript code running in the page scope. However, that extended API is significantly less powerful than what's available to actual browser extensions.

Userscripts are available in most browsers:

Scripts meant for Greasemonkey or Tampermonkey should be tagged or , instead.
If the userscript is meant to be cross-browser compatible (not always worth the trouble), use both and .

Userscript API changes:
For quite some time, the APIs provided by userscript managers were reasonably cross-compatible. Those APIs were synchronous, with the exception of AJAX calls. However, Greasemonkey 4.X re-wrote the APIs it presents to userscripts such that they were asynchronous, using Promises, which makes scripts using those APIs not backwards/cross-compatible. The Greasemonkey project provides a polyfill which userscripts can @require in order to write scripts using their new APIs which will function in other userscript managers.

Tampermonkey has begun to provide support for these Promise based APIs.

Resources:

1300 questions
23
votes
3 answers

Userscripts vs. Chrome Extension

I am developing an extension that will read HTML elements value, then make API calls to an external website, get the results and display them in newly created HTML elements. What are the pro/cons of writing it in native chrome extensions vs.…
Avi Meir
  • 980
  • 3
  • 11
  • 26
22
votes
2 answers

Automatically run JavaScript code upon loading a specific website

I've written scripts to filter out threads and posts in a programming forum by author. But you need to post the code into the web console for each page individually. I was wondering if it were possible and if so how (using either firefox or…
user3124819
21
votes
1 answer

Is it possible to keep single-line comments? (Writing greasemonkey/userscripts in CoffeeScript)

I've noticed that when compiling CoffeeScript, none of the single-line comments are retained. This is problematic as I'm trying to write a greasemonkey/userscript in CoffeeScript, and they rely on comments for the metadata block. I've tried using…
Acorn
  • 49,061
  • 27
  • 133
  • 172
19
votes
4 answers

Downloading an image using XMLHttpRequest in a userscript

First of all there is a question with the same title here on SO but its not what I'm looking for and it doesn't have a complete answer either. So here's my question. Say I have this URL which directs to an…
Isuru
  • 30,617
  • 60
  • 187
  • 303
18
votes
2 answers

Gmail extension/gadget API - how to add a button to the compose toolbar?

I'm trying to figure out how can I add a button to the Gmail compose window. In "Gmail Labs" they have some extensions that add certain buttons For example "Send & Archive" button and "Inserting images" button, so I assume this is possible. I…
17
votes
6 answers

Why doesn't jQuery work in Chrome user scripts (Greasemonkey)?

Possible Duplicate: How can I use jQuery in Greasemonkey scripts in Google Chrome? I'm unable to get this user script to work in Google Chrome. // ==UserScript== // @name voip // @namespace 1 // @description voip // @include …
David Grassi
  • 171
  • 1
  • 1
  • 4
17
votes
1 answer

Can't rename or create more than one custom userscript script in Tampermonkey

I am currently trying to create 3 userscripts in Tampermonkey for separate pages. Using the GUI, I can click on "Add a new script", however every time I save after making changes, it re-saves over the top of 'My Fancy New Userscript' and there…
robmunro
  • 175
  • 1
  • 7
16
votes
1 answer

Adding jQuery UI to Greasemonkey script fails with external CSS file

I'm trying to add jquery-ui to a Greasemonkey script. my full code: test.user.js: // ==UserScript== // @name Test // @namespace rajat.khandelwal // @description Test script // @include * // @require …
prongs
  • 9,422
  • 21
  • 67
  • 105
16
votes
2 answers

Accessing iframes from a Chrome content-script extension

I'm writing a Chrome extension that needs to alter a popular web app when loaded. Unfortunately, most of the UI of that web app is rendered inside an iframe, and although the address of that iframe matches my content_scripts match declaration, the…
dpq
  • 9,028
  • 10
  • 49
  • 69
15
votes
3 answers

Prevent onclick event on a button from firing when hitting Enter in a different box

I need to have a user input field in the #wmd-button-bar of the SE editor, along with a button. The user can enter some data in the input field, and then press a button to process that data. I am using a userscript to achieve this. I have created a…
Gaurang Tandon
  • 6,504
  • 11
  • 47
  • 84
15
votes
4 answers

Enable a non-PlayStore UserScript with Chrome 35 and above

Since the version 35 of Google Chrome, the execution of any extension installed outside of the Google's PlayStore is blocked and cannot be enabled from the extensions menu. The auto-installation of non-store scripts was removed two years ago but…
15
votes
3 answers

User Script Debugging in Google Chrome

What's the best way to debug custom User Scripts (aka Greasemonkey) in Chrome? Is there a way to enable User Script tracking in the Developer Tools?
d34dh0r53
  • 673
  • 1
  • 5
  • 11
15
votes
1 answer

Adding a custom keyboard shortcut using userscript to Chrome with Tampermonkey

I would like to add some custom keyboard shortcuts to a certain web page. Using the accepted answer from this question as a guide: How can I add a JavaScript keyboard shortcut to an existing JavaScript Function? I made my own little function and…
Sint
  • 1,580
  • 3
  • 21
  • 38
15
votes
3 answers

console.log is not working when used in a Firefox, Greasemonkey script

My userscript prints some information using console.log(). This works fine in Chrome, but when I install this userscript in Firefox (Greasemonkey), the web console in Firefox is not displaying anything. I searched for a solution and some suggested…
user1275375
  • 1,361
  • 5
  • 23
  • 38
14
votes
5 answers

Possible to run userscript in IE11

I have a custom userscript that I'm running in Chrome and Firefox using Tampermonkey/Greasemonkey. Is there any way of using this script in IE11? Or is there any plugins for IE11 that does what Tampermonkey/Greasemonkey does?
boston
  • 161
  • 1
  • 1
  • 5
1 2
3
86 87