Skip to content

Instantly share code, notes, and snippets.

@anvinjain
Last active April 30, 2018 18:55
Show Gist options
  • Save anvinjain/c7fb29993496127f165b03cff9129bbb to your computer and use it in GitHub Desktop.
Save anvinjain/c7fb29993496127f165b03cff9129bbb to your computer and use it in GitHub Desktop.
TamperMonkey Script: Disable Incognito Mode check by websites in Chrome
// ==UserScript==
// @name Disable detection of incognito mode in browser by HOTSTAR website
// @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 *://www.hotstar.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);
console.log("Injected script to disable incognito tab detection.");
})();
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment