Skip to content

Instantly share code, notes, and snippets.

@lixin9311
Created June 30, 2021 07:26
Show Gist options
  • Save lixin9311/0c250b48a3369dd4282b6ac9a5d7e5b6 to your computer and use it in GitHub Desktop.
Save lixin9311/0c250b48a3369dd4282b6ac9a5d7e5b6 to your computer and use it in GitHub Desktop.
Tampermokey script overriding document.referrer
// ==UserScript==
// @name Referrer override
// @namespace https://example.com
// @description Override the document.referrer
// @author Lucas Li
// @match https://example.com/*
// @icon https://www.google.com/s2/favicons?domain=example.com
// @grant none
// ==/UserScript==
(function() {
'use strict';
const domain = "https://google.com"
console.log("overriding the document.referrer to " + domain);
delete window.document.referrer;
window.document.__defineGetter__('referrer', function () {
return domain;
});
})();
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment