AEPKILL / devtools-detector

Detect if DevTools is open
https://blog.aepkill.com/demos/devtools-detector/
MIT License
1.1k stars 104 forks source link

False detection problem for some users #55

Open ykdsoft opened 1 year ago

ykdsoft commented 1 year ago

Hi,

First of all, thanks for this awesome library.

I redirect the visitor if devtools open on my site. however some users reported me sometimes they redirect to homepage when reading the arcticle suddenly. and the number of users reporting in this way is increasing.

I am using latest version. Unfortunately I don't have a lot of information. but they usually report that they are using windows 10 chrome. Also the problem is not happen always, happen sometimes. What can i do?

Update: I collected some data from access log. Some browsers (parsed useragent): Chrome 108 on iOS 16.1 Apple iPhone Chrome 108 on Android 11 Chrome 108 on Android 12 Samsung SM-A217F Safari 15.6 on iOS 15.7 Apple iPhone Safari 12.1 on iOS 12.5 Apple iPhone Chrome 108 on Android 11 Mi Note 10

Mostly android and ios seem to have problems.

My code:

function consoleCallback() {
    $("body").empty();

    if (window.location.pathname !== "/") {
        window.location.replace("/");
    }
}

devtoolsDetector.addListener(function(isOpen, detail) {
    if (isOpen)
    {
        if (detail.checkerName != "function-to-string") //for some mobile and ios false detect problem
        {
            consoleCallback();
        }
    }
});

devtoolsDetector.launch();

Thanks.

Praskand commented 3 weeks ago

It may be closed if resolved!