Include all pages in tampermonkey(userscript)

UserscriptsTampermonkey

Userscripts Problem Overview


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

Userscripts Solutions


Solution 1 - Userscripts

// @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      *

Solution 2 - Userscripts

> // @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.

Solution 3 - Userscripts

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)

Solution 4 - Userscripts

The real answer would be to have:

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

Attributions

All content for this solution is sourced from the original question on Stackoverflow.

The content on this page is licensed under the Attribution-ShareAlike 4.0 International (CC BY-SA 4.0) license.

Content TypeOriginal AuthorOriginal Content on Stackoverflow
Questionuser1972757View Question on Stackoverflow
Solution 1 - UserscriptsRichard PlesterView Answer on Stackoverflow
Solution 2 - UserscriptsYoussof H.View Answer on Stackoverflow
Solution 3 - UserscriptsəkauntView Answer on Stackoverflow
Solution 4 - UserscriptsFireyChickenView Answer on Stackoverflow