Questions tagged [greasemonkey]

OBSOLETE as of Firefox 57. Use [greasemonkey-4] or [tampermonkey] as applicable. If using some other browser userscript engine, use [userscripts].

OBSOLETE as of Greasemonkey 4 -- which is a major change that is not backwards compatible.


Usage Hint

Use this tag if you are using Firefox, pre version 57. Use the tag if you are using Tampermonkey on Chrome. For all other userscripts, please use the tag.

GreasemonkeyMain add-on page is a userscript manager for Firefox. Userscripts are written in JavaScript, and run in every page as specified by the @include, @exclude, and @match rules.

Greasemonkey also permits special operations that ordinary javascript is not allowed to do. See the Greasemonkey API.

Userscripts are also available on/for other browsers; see the tag wiki of .
Important: Please use only if you are running the Firefox browser and/or using the add-on.
For all others, use , if it applies, or .


Premade userscripts:

Premade userscripts can be found at:


References:

2842 questions
60
votes
2 answers

Greasemonkey/ Tampermonkey @match for a page with parameters

I'm working on a script that must be executed in a certain page, depending on the parameters it has. The URL is like this: http://example.com/page.php?key1=value1&key2=value2&... And I need to match it when page.php has the key1=value1 among its…
noquierouser
  • 963
  • 2
  • 11
  • 25
59
votes
5 answers

Detect iFrame embedding in Javascript

I have an application that has a certain page -- let's call it Page A. Page A is sometimes a top-level page, but also sometimes is embedded as an iframe within page B. All pages come from the same server and there are no cross-domain issues. I have…
Cheekysoft
  • 35,194
  • 20
  • 73
  • 86
57
votes
4 answers

Open a new tab with custom HTML instead of a URL

I'm making a Greasemonkey script and would like to open a new tab which will not display a URL but some HTML that is part of the script. So basically I want to do something like this (which is obviously not…
kasper Taeymans
  • 6,950
  • 5
  • 32
  • 51
56
votes
1 answer

Why is usage of the downloadURL & updateURL keys called unusual and how do they work?

I was reading GM's wiki to determine the difference between @downloadURL & @updateURL (which I didn't). But what confused me even more that both are unadvised: It is unusual to specify this value. Most scripts should omit it. I'm surprised by that…
ZeroUnderscoreOu
  • 679
  • 1
  • 5
  • 11
55
votes
7 answers

How can I intercept XMLHttpRequests from a Greasemonkey script?

I would like to capture the contents of AJAX requests using Greasemonkey. Does anybody know how to do this?
Scooby Doo
52
votes
10 answers

How to debug Greasemonkey script with the Firebug extension?

I didn't find a way to debug Greasemonkey scripts with the Firebug extension. Does anyone know how to do this ? Thanks.
WolveFred
  • 1,623
  • 3
  • 14
  • 15
52
votes
1 answer

How to simulate typing in input field using jQuery?

What I want is to simulate typing in field using javascript. I have the following code: var press = jQuery.Event("keydown"); press.ctrlKey = false; press.which = 65; $("#test").trigger(press); But when I load the page, the #test input field…
50
votes
4 answers

Can jQuery selectors be used with DOM mutation observers?

HTML5 includes a concept of "mutation observers" to monitor changes to the browser's DOM. Your observer callback will be passed data which looks a lot like DOM tree snippets. I don't know if they are exactly this or how they work really. But when…
hippietrail
  • 15,848
  • 18
  • 99
  • 158
48
votes
1 answer

How/Where to store data in a Chrome Tampermonkey script other than localStorage?

I wrote one Greasemonkey/Tampermonkey script for Facebook . I needed to store data to retrieve it later. For that I used localStorage. That was working fine. But I noticed that after few hours all data which I stored was removed automagically.…
Rakesh Juyal
  • 35,919
  • 68
  • 173
  • 214
45
votes
4 answers

Injecting JS functions into the page from a Greasemonkey script on Chrome

I have a Greasemonkey script that works just fine in Firefox and Opera. I struggle with getting it to work in Chrome, however. The problem is injecting a function into the page that can be invoked by code from the page. Here's what I'm doing so…
44
votes
13 answers

Unique element ID, even if element doesn't have one

I'm writing a GreaseMonkey script where I'm iterating through a bunch of elements. For each element, I need a string ID that I can use to reference that element later. The element itself doesn't have an id attribute, and I can't modify the original…
Robert J. Walker
  • 10,027
  • 5
  • 46
  • 65
40
votes
2 answers

Run Greasemonkey script on the same page, multiple times?

I'm totally new to Greasemonkey, javascript, in fact all the UI stuff. Requirement: Userscript is run by GS once after the page loads. However, I need the same script to be run multiple times without refresh Use case: For ex, Amazon.com search…
Firefox
  • 941
  • 2
  • 14
  • 22
39
votes
7 answers

alert a variable value

How do I display the value of a variable in javascript in an alert box? For example I've got a variable x=100 and alert(x) isn't working. the script used in grease monkey is here var inputs = document.getElementsByTagName('input'); var new; for…
technocrat
  • 701
  • 5
  • 13
  • 23
39
votes
6 answers

Get subdomain and load it to url with greasemonkey

I am having the URL http://somesubdomain.domain.com (subdomains may vary, domain is always the same). Need to take subdomain and reload the page with something like domain.com/some/path/here/somesubdomain using greasemonkey (or open a new window…
user157011
38
votes
1 answer

Replace remote JavaScript file with a local debugging copy using Greasemonkey or userscript

While debugging a client app that uses a Google backend, I have added some debugging versions of the functions and inserted them using the Chrome Developer Tools script editor. However there are a number of limitations with this approach, first is…
Tom
  • 3,324
  • 1
  • 31
  • 42