-4

Question: Is there a easy way to detect the browser of the user ?

Details: I would like to change for example the value of background-color of body. I've already see something like <!--[if !IE]>.

Edit:

Okay, I agree, browser detect is bad (Link taken from @TylerH), and should not be used. Thank I take note. And If someone really still want to use them, I've found a good website with a list of browser detection hack.

Alaanor
  • 255
  • 4
  • 20
  • 6
    [Browser Detection Is Bad](http://css-tricks.com/browser-detection-is-bad/) – TylerH Apr 09 '14 at 15:40
  • Why ? Whit this, I can resolve compatibility problem for my website, no ? – Alaanor Apr 09 '14 at 15:42
  • Why are you wanting to detect a browser this way? A personal vendetta? It's best to just write standards-compliant code, and then where necessary, add browser-specific prefixes for your properties. – TylerH Apr 09 '14 at 15:44
  • 1
    No, you wouldn't be resolving compatibility problems, you'd be masking compatibility problems. Fix the issue by addressing the problem, not the symptom. – zzzzBov Apr 09 '14 at 15:51
  • Possible duplicate of [How to detect Safari, Chrome, IE, Firefox and Opera browser?](https://stackoverflow.com/questions/9847580/how-to-detect-safari-chrome-ie-firefox-and-opera-browser) – SuperStormer Nov 22 '18 at 04:19

1 Answers1

0

I think there is no way to do it with HTML or CSS (I don't like hacks). But you could check the user agent string with JS.

See here: How to make CSS visible only for Opera

Community
  • 1
  • 1
Hendrik
  • 131
  • 1
  • 10