Stack Overflow
About
Products
For Teams
Home
Questions
Tags
Users
Companies
Labs
Discussions
New
Collectives
Explore Collectives
Teams
Stack Overflow for Teams – Start collaborating and sharing organizational knowledge.
Include all pages in tampermonkey(userscript)
Asked 10 years, 11 months ago
Modified 1 year, 4 months ago
Viewed 59k times
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
userscriptstampermonkey
Share
Improve this question
Follow
edited Mar 18, 2013 at 12:08
asked Mar 18, 2013 at 11:11
user1972757's user avatar
user1972757
73111 gold badge55 silver badges66 bronze badges
At least show your script! The URL "trimming" is just a display choice, it is not the problem. –
Brock Adams
Mar 18, 2013 at 11:33
Add a comment
5 Answers
Sorted by:
97
// @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 *
Share
Improve this answer
Follow
edited Apr 17, 2013 at 13:10
answered Apr 2, 2013 at 21:30
Richard Plester's user avatar
Richard Plester
1,16866 silver badges1111 bronze badges
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. –
Brock Adams
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! –
Richard Plester
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. –
Brock Adams
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. –
Brock Adams
Apr 17, 2013 at 12:03
1
Tampermonkey no longer supports '*", so use the more appropriate suggestions shown here now... –
Kevin
Dec 3, 2018 at 6:52
Show 3 more comments
18
// @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:
WebExtensions Match Patterns Mozilla Documentation
Match Patterns Google Documentation
So accordingly: :///* matches all HTTP, HTTPS, and WebSocket URLs.
Share
Improve this answer
Follow
edited Sep 4, 2019 at 21:52
answered Jul 16, 2018 at 11:37
Joe's user avatar
Joe
94933 gold badges1515 silver badges3838 bronze badges
not working, scheme has to be a text : // @match https://*/* // @match http://*/* –
Nicolas Thery
Nov 26, 2022 at 9:40
Add a comment
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)
Share
Improve this answer
Follow
answered Feb 18, 2020 at 21:55
əkaunt's user avatar
əkaunt
10911 silver badge33 bronze badges
looks deprecated –
Nicolas Thery
Nov 26, 2022 at 9:39
Add a comment
5
The real answer would be to have:
// @match https:///
// @match http:///
Share
Improve this answer
Follow
edited Mar 5, 2020 at 16:48
Adrian Mole's user avatar
Adrian Mole
51.1k181181 gold badges5353 silver badges8686 bronze badges
answered Mar 5, 2020 at 16:12
FireyChicken's user avatar
FireyChicken
8411 silver badge66 bronze badges
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. –
powersource97
Jul 30, 2020 at 4:23
Please upvote this one as there is obsolete answer in any others –
Nicolas Thery
Nov 26, 2022 at 9:40
Add a comment
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
Share
Improve this answer
Follow
answered Oct 1, 2022 at 1:56
justpeanuts's user avatar
justpeanuts
1922 bronze badges
Add a comment
Your Answer
By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.
Not the answer you're looking for? Browse other questions tagged
userscriptstampermonkey
or ask your own question.
The Overflow Blog
Down the rabbit hole in the Stack Exchange network
Even LLMs need education—quality data makes LLMs overperform
Featured on Meta
Upcoming privacy updates: removal of the Activity data section and Google...
Changing how community leadership works on Stack Exchange: a proposal and...
Temporary policy: Generative AI (e.g., ChatGPT) is banned
2024 Moderator Election Q&A – Question Collection
Related
2
In a Greasemonkey script, how can I target a page by its elements?
3
tampermonkey script stops working if I change the page
3
How to include Local htm pages in a Tampermonkey script?
26
Tampermonkey script run before page load
3
Tampermonkey - Match default start page
1
Userscript, that requires page's javascript, runs in JS console but not in Tampermonkey
1
How to set a userscript to run on an array of websites?
1
Matching just the root/home page in Tampermonkey / Greasemonkey?
1
How can i load an external script on a webpage using tampermonkey?
2
tampermonkey script run accross multiple pages
Hot Network Questions
MPL license: Can I completely lose grants?
Inductor as insulator?
How to define (not reproject) a CRS of a shapefile in QGIS?
Has this "everything category" been defined before?
Every matrix is a product of two symmetric matrices
more hot questions
Question feed
Stack Overflow
Questions
Help
Products
Teams
Advertising
Collectives
Talent
Company
About
Press
Work Here
Legal
Privacy Policy
Terms of Service
Contact Us
Cookie Settings
Cookie Policy
Stack Exchange Network
Technology
Culture & recreation
Life & arts
Science
Professional
Business
API
Data
Blog
Facebook
Twitter
LinkedIn
Instagram
Site design / logo © 2024 Stack Exchange Inc; user contributions licensed under CC BY-SA. rev 2024.2.26.5346