-
-
Notifications
You must be signed in to change notification settings - Fork 4
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
[feature request] Add Scrollbar width detection #11
Comments
Thanks for your suggestion! |
using System.Runtime.InteropServices;
[DllImport("user32.dll")]
static extern int GetSystemMetrics(int nIndex);
const int SM_CXVSCROLL = 2;
int scrollBarWidth = GetSystemMetrics(SM_CXVSCROLL);
Console.WriteLine($"Scrollbar width: {scrollBarWidth}"); // 17
function getScrollbarWidth() {
const container = document.createElement("div");
container.style.position = "absolute";
container.style.top = "-9999px";
container.style.width = "100px";
container.style.height = "100px";
container.style.overflow = "scroll";
container.style.msOverflowStyle = "scrollbar";
document.body.appendChild(container);
const inner = document.createElement("div");
inner.style.width = "100%";
inner.style.height = "100%";
container.appendChild(inner);
const rawScrollbarWidth = container.offsetWidth - inner.offsetWidth;
const devicePixelRatio = window.devicePixelRatio;
const actualScrollbarWidth = rawScrollbarWidth * devicePixelRatio;
document.body.removeChild(container);
return { devicePixelRatio: devicePixelRatio, actualScrollbarWidth };
} This approach helps ensure that the computed value reflects the scaling factor, offering a more robust and accurate method for detecting the scrollbar width. |
Hmm this really sounds AI generated to me - I get the point but will have to do more testing on that before implementing The OS part makes sense to me though |
How wise of you I had AI generate the code for me and I copied it right over lol , wait for your results. |
First of all, I want to express my admiration for your work. Thank you for your efforts in the field of bot and antibot technologies.
I’d like to suggest a detection method that has been used in strict antibot solutions (eg, AdScore) for several years. However, this method has not yet been widely implemented in mainstream antibots like Shape, Akamai, Cloudflare, px
The proposed method involves detecting the scrollbar width, as demonstrated in the following function:
Based on testing:
For bots, this value should correspond to the OS being emulated. For antibots, this could serve as a straightforward lied detection method.
I hope this idea proves useful to your project(s), thanks.
The text was updated successfully, but these errors were encountered: