Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

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

like image 568
user1972757 Avatar asked Mar 18 '13 11:03

user1972757


People also ask

How do you code Tampermonkey?

To get started, install Tampermonkey. Tap its toolbar icon, and select Add a new script . An editor opens with a default script. There's a bunch of metadata at the top; fill out the @match field to control where the script will run.

How do I add Tampermonkey script to Chrome?

Go to Chromes extensions page, enable the Allow access to file URLs checkbox at the Tampermonkey item, create a file with the file extensions . tamper. js and drag-and-drop it to Chrome.

Is Tampermonkey safe to use?

Let's quickly summarize: Tampermonkey itself is neither safe nor unsafe; it's just a tool for managing user scripts. However, many user scripts can potentially be dangerous and contain malware. Other user scripts can be bad in the sense that they have unintended side effects, like bad CPU performance.


2 Answers

// @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      * 
like image 102
Richard Plester Avatar answered Sep 18 '22 17:09

Richard Plester


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

like image 43
Youssof H. Avatar answered Sep 18 '22 17:09

Youssof H.