I agree with @bechtold , using the user agent is a bad idea, there are multiple features to consider, I recommend this article on how to use media queries in JavaScript, I think it is a bester practice.
@jeancarlo13 the problem with using media queries in JS is that it causes layout shift (FOUC) and it's a problem mainly on above-the-fold UI. Otherwise it's a good approach.
For further actions, you may consider blocking this person and/or reporting abuse
We're a place where coders share, stay up-to-date and grow their careers.
"Browser identification based on detecting the user agent string is unreliable and is not recommended, as the user agent string is user configurable."
If we require that users don't modify their UserAgent in order to use our website then the UserAgent is perfectly reliable!
I agree with @bechtold , using the user agent is a bad idea, there are multiple features to consider, I recommend this article on how to use media queries in JavaScript, I think it is a bester practice.
"using the user agent is a bad idea, there are multiple features to consider"
Would you elaborate on why using the user agent is a bad idea? (Also, I'm not sure if you meant features or some other word.)
@jeancarlo13 the problem with using media queries in JS is that it causes layout shift (FOUC) and it's a problem mainly on above-the-fold UI. Otherwise it's a good approach.