

Userscripts have been a mainstay of web browsing since at least Firefox 2, before Chrome was even conceived. It you remove the ability to use userscripts, not only would I have to switch browsers, but I would actively encourage others to do so, so they could continue using my scripts. Use it at your own risk.I am both a user and developer.

You can always turn these off in Tampermonkey. Here’s my final solution:Īn important thing to know if you work with Tampermonkey in incognito mode: your changes made in incognito mode won’t appear in normal mode, and vice versa: you have to close all your private windows if you want to try your latest changes made in public mode.īe careful! If you decide to use my script, you have to know that this might (although not very likely) break some web pages. I realized that I should add those few lines of monkey patch code as a string, and fill in the script element’s text with that. Finally I ended up using, which was exactly the right tool for this. But then the browser was complaining about its MIME type. So I decided to put my code in a GitHub gist, and tried to load the raw file. However it’s not the case with Tampermonkey scripts (at least I don’t know about it).

I could test the module by pasting it in incognito and public browser window dev console and run: var module = injectScript(url, document.documentElement) ĭetour 2: As I started with an extension, loading another JavaScript file was trivial. I found this bit in one of those private loathing sites’ minified JavaScript code. This StackOverflow answer gave me a hint, so I knew I’d have to look for webkitRequestFileSystem. As per my best knowledge, there’s no browser API to detect private mode directly, so I was pretty sure it is a sneaky little script. I thought this might be worth sharing.įirst, I had to look up how to detect private mode. The whole thing took me about two hours and I learned a lot about browser extensions and hacking client-side code as an end user. I know that incognito is not safe but it’s the bare minimum you can do to avoid ads to track you. This is a way to enforce their tracking tools. I should be allowed to use whatever browser and mode I want. Recently I came across several sites that showed a warning or paywall because I was using incognito mode.

By Mátyás Fodor How to outsmart incognito block
