72

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
// @match      http://*/*
// @run-at     document-end

var req = new XMLHttpRequest();
req.open('GET', document.location, false);
req.send(null);
var headers = req.status;
var locheader=req.getResponseHeader("Location");
alert(headers);
alert(locheader);

Have I done something wrong.please help me to run this userscript in all pages in chrome

1
  • At least show your script! The URL "trimming" is just a display choice, it is not the problem. Commented Mar 18, 2013 at 11:33

5 Answers 5

100
// @match      http://*/*

will only match addresses starting with http://... but not https://... for example.

Use the following to include all addresses if that's what you really require (including local pages you may have saved on your hard-drive!)..

// @match      *://*/*

Note: The method below also works at the time of writing by virtue of a potential bug or undocumented feature in TM2.12 (so could well be subject to change in future versions!!):

// @match      *
8
  • 5
    @match * is not a valid pattern. See the doc page and there can be more than one @match line. The OP's metadata block is corrupt and the OP appears to have abandoned this question. Commented Apr 17, 2013 at 1:09
  • Shame on OP if has abandoned, though it's still a useful QA. Would the generally correct syntax be // @match *//*/* ? For the record I have scripts with match * working under TamperMonkey 2.12! Commented Apr 17, 2013 at 8:42
  • Close, you need the colon. See the doc. That's interesting about * in Tampermonkey. I'm going off the Chrome rules -- which are supposed to be the master for @match in both Greasemonkey and Tampermonkey. I wonder if Tampermonkey works despite the error -- while Chrome does not. I'll test this at some point. Commented Apr 17, 2013 at 8:56
  • 2
    Okay tested it myself and * works while <all_urls> does not! There is no error in Tampermonkey, even in verbose mode, for either one. This is all a bug, AFAIC, and it's not consistent with Chrome nor Greasemonkey. Still, your answer is more correct than I thought. +1. Commented Apr 17, 2013 at 12:03
  • 1
    Tampermonkey no longer supports '*", so use the more appropriate suggestions shown here now...
    – Kevin
    Commented Dec 3, 2018 at 6:52
19

// @match *://*/*

This should find all URLs. Using TamperMonkey/GreaseMonkey

// ==UserScript==
// @name         Match Every Site
// @namespace    http://tampermonkey.net/
// @version      1.1
// @description  I will pop up on every site!!
// @author       You
// @match        *://*/*
// @grant        none
// ==/UserScript==

alert("I am working!")

This might be useful for browser-extensions on some pages:

So accordingly: *://*/* matches all HTTP, HTTPS, and WebSocket URLs.

1
  • not working, scheme has to be a text : // @match https://*/* // @match http://*/* Commented Nov 26, 2022 at 9:40
8

Doing @include instead of @match works quite nicely

// ==UserScript==
// @name       Phishing Blockz
// @namespace  http://use.i.E.your.homepage/
// @version    0.1
// @description Phishing block based on hyperlinks
// @include     *
// @run-at     document-end

this works on all websites across the web (tested in TamperMonkey)

1
  • looks deprecated Commented Nov 26, 2022 at 9:39
6

The real answer would be to have:

// @match https://*/*
// @match http://*/*
2
  • 1
    Latest documentation from tampermonkey.net/documentation.php#_match says that it is possible to simple include 'http*://'. It does widen the scope, but I think it is highly unlikely there are other protocols that start with http and are not http/https. Commented Jul 30, 2020 at 4:23
  • Please upvote this one as there is obsolete answer in any others Commented Nov 26, 2022 at 9:40
0

For me, using

// @match https://*/*
// @match http://*/*

DOES NOT work. Rather, I have to use @include for tampermonkey to load scripts on all pages in my device,

// @include https://*/*
// @include http://*/*

FYI: I am using tampermonkey in Fennec v105.1(Firefox android version in F-droid) running in android 10

Not the answer you're looking for? Browse other questions tagged or ask your own question.