2022-03-27 11:43:26 +00:00
|
|
|
let nav = function Navigator() {};
|
|
|
|
let copyNavRef = window.navigator;
|
|
|
|
nav = nav.bind(function () {
|
|
|
|
return window.navigator;
|
|
|
|
});
|
|
|
|
newNav = new nav();
|
2022-03-28 18:26:22 +00:00
|
|
|
const primitivesNav = {
|
2022-03-27 11:43:26 +00:00
|
|
|
userAgent: window.navigator.userAgent,
|
|
|
|
appVersion: window.navigator.appVersion,
|
|
|
|
platform: window.navigator.platform,
|
|
|
|
vendor: window.navigator.vendor,
|
2022-03-28 15:26:32 +00:00
|
|
|
language: window.navigator.language,
|
2022-03-28 17:54:45 +00:00
|
|
|
cookieEnabled: true,
|
2022-03-28 18:26:22 +00:00
|
|
|
appCodeName: window.navigator.appCodeName,
|
|
|
|
appName: window.navigator.appName,
|
|
|
|
product: window.navigator.product,
|
|
|
|
geolocation: window.navigator.geolocation,
|
|
|
|
onLine: window.navigator.onLine,
|
2022-03-28 19:47:37 +00:00
|
|
|
sendBeacon: window.navigator.sendBeacon.bind(window.navigator),
|
2022-03-25 18:10:48 +00:00
|
|
|
};
|
2022-03-28 18:26:22 +00:00
|
|
|
|
2022-03-25 18:10:48 +00:00
|
|
|
for (let prop in window.navigator) {
|
|
|
|
if (prop === 'brave') {
|
|
|
|
continue;
|
|
|
|
}
|
2022-03-28 19:47:37 +00:00
|
|
|
newNav[prop] = copyNavRef[prop];
|
2022-03-25 18:10:48 +00:00
|
|
|
}
|
2022-03-28 18:26:22 +00:00
|
|
|
for (let prop in primitivesNav) {
|
|
|
|
primitivesNav.hasOwnProperty(prop) &&
|
2022-03-25 18:10:48 +00:00
|
|
|
Object.defineProperty(newNav, prop, {
|
2022-03-28 18:26:22 +00:00
|
|
|
value: primitivesNav[prop],
|
2022-03-25 18:10:48 +00:00
|
|
|
writable: true,
|
|
|
|
});
|
|
|
|
}
|
|
|
|
Object.defineProperty(window, 'navigator', {
|
|
|
|
value: newNav,
|
|
|
|
writable: true,
|
2022-03-27 11:43:26 +00:00
|
|
|
enumerable: true,
|
|
|
|
configurable: true,
|
2022-03-28 19:47:37 +00:00
|
|
|
});
|