Skip to content

Instantly share code, notes, and snippets.

@ehershey
Forked from matyasfodor/incognitoTrick.js
Last active July 9, 2018 22:12
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save ehershey/851e9d6f27bdc6a91d80d6b121b8238e to your computer and use it in GitHub Desktop.
Save ehershey/851e9d6f27bdc6a91d80d6b121b8238e to your computer and use it in GitHub Desktop.
Tampermonkey script to fake incognito check
// ==UserScript==
// @name Incognito trick
// @namespace http://tampermonkey.net/
// @version 0.1
// @description Prevent sites detecting if you're in incognito by calling the success callback of webkitRequestFileSystem even if it's failing.
// @author You
// @run-at document-start
// @match http://www.cnbc.com/*
// @grant none
// ==/UserScript==
(function() {
'use strict';
function injectScript(script, node) {
var element = document.createElement('script');
element.setAttribute('type', 'text/javascript');
element.setAttribute('async', false);
element.text = script;
node.appendChild(element);
}
var node = document.documentElement;
var script = `(function(webkitRequestFileSystem) {
window.webkitRequestFileSystem = function(type, size, successCallback, errorCallback) {
webkitRequestFileSystem(type, size, successCallback, successCallback);
}
})(window.webkitRequestFileSystem);`;
injectScript(script, node);
})();
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment