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)
Tampermonkey script that runs only in incognito?
Asked Answered
This is a duplicate of "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. –
Claycomb
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.
Tampermonkey needs "split" mode support by the browser: developer.mozilla.org/en-US/Add-ons/WebExtensions/manifest.json/… –
Glyptodont
© 2022 - 2024 — McMap. All rights reserved.