Questions tagged [tampermonkey]

Tampermonkey is a userscript manager for Google Chrome, Microsoft Edge, Safari, Firefox, Opera, Dolphin Browser, and UC Browser. Tampermonkey scripts are privileged JavaScript code snippets, with access to a custom API that allows you to customize the way web pages look and act.

Tampermonkey is a userscript manager for Google Chrome, Microsoft Edge, Safari, Opera Next, and Firefox.

Tampermonkey allows users to apply customized javascript to sites, to alter how the sites look and/or behave. Multiple websites can even be "mashed up" via cross-site scripting techniques. (Tampermonkey scripts have fewer security restrictions than ordinary javascript).

Tampermonkey differs from native Chrome userscripts in that Tampermonkey supports almost all of the Greasemonkey API, and Tampermonkey scripts are now easier to install and manage than native userscripts. Installation is not restricted to Google's store, so popular sites like userscripts.org still work.

Tagging Guidance:

Please do not tag Tampermonkey questions with , unless the script is meant to also work as a native Chrome userscript (which is usually not the case).


References and Resources:

1715 questions
213
votes
17 answers

window.close and self.close do not close the window in Chrome

The issue is that when I invoke window.close() or self.close() it doesn't close the window. Now there seems to be a belief that in Chrome you can't close by script any window that is not script created. That is patently false but regardless it is…
GµårÐïåñ
  • 2,846
  • 5
  • 31
  • 35
164
votes
2 answers

Trying to load jquery into tampermonkey script

I am writing a script which logs into my college network when the login page is loaded. The code looks as follows // ==UserScript== // @name My Fancy New Userscript // @namespace http://use.i.E.your.homepage/ // @version 0.1 //…
Jonah
  • 2,097
  • 4
  • 20
  • 22
125
votes
7 answers

Userscript to wait for page to load before executing code techniques?

I'm writing a Greasemonkey user script, and want the specific code to execute when the page completely finishes loading since it returns a div count that I want to be displayed. The problem is, that this particular page sometimes takes a bit before…
Myne Mai
  • 1,305
  • 2
  • 10
  • 7
78
votes
1 answer

Debug tampermonkey script

I would like to debug a Tampermonkey script with Chrome's console, but I can't find my script in the list.. Am I doing something wrong, or is it just that the Tampermonkey scripts don't appear there? And in that case, how can I debug it?
thestral
  • 971
  • 1
  • 6
  • 12
71
votes
5 answers

Include all pages in tampermonkey(userscript)

I have to include all sites in tampermonkey..this is the script that i have to run // ==UserScript== // @name Phishing Blockz // @namespace http://use.i.E.your.homepage/ // @version 0.1 // @description Phishing block based on hyperlinks //…
user1972757
  • 721
  • 1
  • 5
  • 6
69
votes
3 answers

Simulating a mousedown, click, mouseup sequence in Tampermonkey?

I would like to simulate a whole click not just document.getElementsByClassName()[0].click(); How do I do that? Search results all seem to be about handling such events, not triggering them.
67
votes
5 answers

Detecting combination keypresses (Control, Alt, Shift)?

I am trying to make a script run when Ctrl + Alt + e is pressed. How can Tampermonkey fire on a simultaneous ctrl, alt, and e key? I have tried ctrlKey, and altKey. I've found nothing that works. How can I edit the script below to fire on Ctrl +…
Rasspy
  • 673
  • 1
  • 5
  • 5
67
votes
2 answers

How to change a class CSS with a Greasemonkey/Tampermonkey script?

I'm trying to set the background image of the body, but only where it uses the class banner_url. The HTML is as follows: Basically, I would like to force the page to use…
Xeo
  • 831
  • 2
  • 10
  • 14
60
votes
2 answers

What is the difference between @include and @match in userscripts?

The GreaseSpot page on metadata blocks says that the two are very similar but @match "sets more strict rules on what the * character means." GreaseSpot then proceeds to teach using @include, but Chrome examples like this generally seem to use…
WBT
  • 2,249
  • 3
  • 28
  • 40
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
58
votes
2 answers
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
53
votes
7 answers

GM_addStyle equivalent in TamperMonkey

Is there a TamperMonkey equivalent to GreaseMonkey's GM_addStyle method for adding CSS? In GreaseMonkey, you can add a bunch of CSS properties to multiple elements like so: GM_addStyle("body { color: white; background-color: black; } img { border:…
arserbin3
  • 6,010
  • 8
  • 36
  • 52
48
votes
8 answers

How can I develop my userscript in my favourite IDE and avoid copy-pasting it to the Tampermonkey's editor every time?

For security reasons, Tampermonkey scripts are not saved in accessible files, but in a plugin data. The only way to edit them is to use Tampermonkey's integrated editor. However, I'd rather use IDE, with all its features. I also want to use webpack…
Tomáš Zato
  • 50,171
  • 52
  • 268
  • 778
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
1
2 3
99 100