Skip to content

Instantly share code, notes, and snippets.

@kageroh
Created July 9, 2012 10:15
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 kageroh/3075612 to your computer and use it in GitHub Desktop.
Save kageroh/3075612 to your computer and use it in GitHub Desktop.
JavaScript からは Cookie が無効に見えたり、DNT が yes に見えるやつ。
// ==UserScript==
// @name secure.js
// @namespace http://twitter.com/amasawa
// @include *
// ==/UserScript==
(function () {
try {
var e = function () { return ''; };
var f = function () { return false; };
var y = function () { return 'yes'; };
Object.defineProperty(document, 'cookie', {
get: e,
set: e,
configurable: false
});
Object.defineProperty(navigator, 'cookieEnabled', {
get: f,
set: f,
configurable: false
});
Object.defineProperty(navigator, 'doNotTrack', {
get: y,
set: y,
configurable: false
});
} catch (e) {
alert(e);
}
}());
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment