How to prevent Chrome Dev Tools Detection?

83 views Asked by At

I just saw this article. How to detect mobile or desktop and not get "cheated" by chrome dev tools

It shows some special ways to detect the browser is real mobile device or Chrome Dev Tools. My question is how to prevent this so that act like a real mobile browser.

This is the code to detect Chrome Dev Tools.

windowsPlatforms = ['Win32', 'Win64', 'Windows', 'WinCE'];
android = "Android";
typeOfOS = window.navigator.platform;

if (windowsPlatforms.includes(typeOfOS)) {
     //do for windows
} else if(typeOfOS === android){
     //do for android
}

In the article above, there are some other ways to detect Chrome Dev Tools.

Is there any method or tools that fully emulate the real mobile device?

1

There are 1 answers

1
Stefan Momcilovic On

Try look at this, there is many ways and libraries that can help you with this

https://dev.to/composite/a-simple-way-to-detect-devtools-2ag0