Is it possible to make any script into a script that only runs on www.example.com, Only if the website is being accessed from an incognito window? (chrome)
Asked
Active
Viewed 8,163 times
10
-
1This is a duplicate of ["Is it possible to determine if Chrome is in incognito mode via a user-script?"](http://stackoverflow.com/questions/2916876/is-it-possible-to-determine-if-chrome-is-in-incognito-mode-via-a-user-script). The answer is the same, you must use an extension to do this. Fortunately, @derjanb has just rolled this feature into Tampermonkey. – Brock Adams Apr 23 '13 at 04:03
1 Answers
14
I've added a isIncognito flag to Tampermonkey's GM_info. So you now can check the incognito mode like this:
// ==UserScript==
// @name testIncognito
// @namespace http://tampermonkey.net/
// @version 0.1
// @description enter something useful
// @match http://*/*
// @copyright 2012+, You
// ==/UserScript==
if (GM_info.isIncognito) {
alert([ GM_info.scriptHandler, 'detected incognito mode @', window.location.href ].join(' '));
}
Please not that this at the moment only is available at TM beta version 3.0.3353 and higher.
-
1Tampermonkey needs "split" mode support by the browser: https://developer.mozilla.org/en-US/Add-ons/WebExtensions/manifest.json/incognito#Browser_compatibility – derjanb Mar 24 '18 at 18:50