我在我的网站上使用了第三方脚本(Chaordic loader.js 用于产品推荐),它被document.referrer
垃圾覆盖,让我很头疼。
问题:有没有办法防止这种修改?我可以document.referrer
以某种方式“冻结/密封”吗?
我知道我可以取消与公司的合同,但想先试试这个锁。我可以在第三方代码之前或之后放置 javascript 代码,但不能修改它。
覆盖的第三方代码document.referrer
:
var t = window.chaordic && window.chaordic.readCookie && window.chaordic.readCookie(e);
Object.defineProperty(window.document, "referrer", {
configurable: false,
get: function() { return t }
});