Files
post_crawler/.venv/Lib/site-packages/playwright_stealth/js/evasions/chrome.hairline.js
T
2026-05-26 21:02:17 +08:00

15 lines
442 B
JavaScript

log("loading chrome.hairline.js");
// inspired by: https://intoli.com/blog/making-chrome-headless-undetectable/
const elementDescriptor = Object.getOwnPropertyDescriptor(HTMLElement.prototype,
"offsetHeight");
utils.replaceProperty(HTMLDivElement.prototype, "offsetHeight", {
get: function() {
// hmmm not sure about this
if (this.id === "modernizr") {
return 1;
}
return elementDescriptor.get.apply(this);
}
});