Questions tagged [browser-detection]

Detecting the type and version of the browser the user uses to view the webpage.

Detecting the type and version of the browser the user uses to view the webpage. Most of the time the decision is based on the User-agent string or the existence of some proprietary properties.

In most cases, it is considered bad practice. Feature detection is to be used instead.

520 questions
93
votes
1 answer

How to target Microsoft Edge with CSS?

I would like to target Edge and have flexbox behave simliar to Firefox 33 / Chrome, for more detail see this question. Can one target Edge in CSS?
maxhungry
  • 1,863
  • 3
  • 20
  • 28
88
votes
11 answers

Environment detection: node.js or browser

I'm developping a JS-app that needs to work both on the client side and the server side (in Javascript on a browser and in Node.js), and I would like to be able to reuse the parts of the code that are used for both sides. I have found out that…
edi9999
  • 19,701
  • 13
  • 88
  • 127
77
votes
14 answers

Best way to check for IE less than 9 in JavaScript without library

What would be your fastest, shortest (best) way to detect browser which is IE and version less than 9 in JavaScript, without using jQuery or any add-on libraries?
bcm
  • 5,470
  • 10
  • 59
  • 92
76
votes
17 answers

server-side browser detection? node.js

Most implementations i've seen are for browser detection on the client side. I was just wondering if it was possible to do browser detection before sending any resources to the client. Thanks.
fancy
  • 48,619
  • 62
  • 153
  • 231
68
votes
11 answers

How to detect browser with Angular?

I need to detect if browser is IE or Edge with Angular (TypeScript). Is it possible? If so, how?
Liutas
  • 5,547
  • 4
  • 23
  • 22
64
votes
13 answers

Easiest/Lightest Replacement For Browser Detection jQuery 1.9?

I had several clients complain yesterday that some code stopped working. Apparently it comes down to plug-ins using the now deprecated jQuery.browser which stopped working yesterday when jQuery 1.9 was released. I (quickly) looked at the 1.9 change…
jchwebdev
  • 5,034
  • 5
  • 21
  • 30
60
votes
8 answers

How do you detect support for VML or SVG in a browser

I'm writing a bit of javascript and need to choose between SVG or VML (or both, or something else, it's a weird world). Whilst I know that for now that only IE supports VML, I'd much rather detect functionality than platform. SVG appears to have a…
Jim T
  • 12,336
  • 5
  • 29
  • 43
53
votes
8 answers

Browser detection

I need to separate IE and FF browsers from others it's a pseudo-code : If (CurrentBrowser == IE(6+) or FF(2+) ) { ... } else { ... } in protected void Page_Load() event (think so) if ((Request.Browser.Type == "IE") || (Request.Browser.Type ==…
cnd
  • 32,616
  • 62
  • 183
  • 313
52
votes
3 answers

Rails Browser Detection Methods

Hey Everyone, I was wondering what methods are standard within the industry to do browser detection in Rails? Is there a gem, library or sample code somewhere that can help determine the browser and apply a class or id to the body element of the…
alvincrespo
  • 9,224
  • 13
  • 46
  • 60
51
votes
6 answers

What's the replacement for $.browser

The jQuery document tags $.browser as deprecated. So what's the replacement for it?
Rocky
  • 5,486
  • 8
  • 32
  • 36
47
votes
15 answers

Javascript IE detection, why not use simple conditional comments?

In order to detect IE most Javascript libaries do all sort of tricks. jQuery seem to add a temporary object into your pages's DOM to detect some features, YUI2 does regex on the user agent in its YAHOO.env.ua = function() (file yahoo.js) After…
47
votes
11 answers

How to target Edge browser with javascript

I know you should do feature detection where possible, but can you detect in Javascript if the browser is the Microsoft Edge browser? I maintain an old product and I want to display a warning that some features could be broken without having to…
Willem de Wit
  • 8,604
  • 9
  • 57
  • 90
45
votes
14 answers

IE8 css selector

To target elements only in IE browsers i'll use IE6: * html #nav li ul { left: -39px !important; border: 1px solid red; } IE7: *+html #nav li ul { left: -39px! important; } Does anyone know how to target IE8?
41
votes
11 answers

reliable user browser detection with php

Trying to detect a user's browser with PHP only, is $_SERVER['HTTP_USER_AGENT'] a reliable way? Should I instead opt for the get_browser function? which one do you find brings more precise results? If this method is pragmatic, is it ill advised to…
Gal
  • 23,122
  • 32
  • 97
  • 118
37
votes
4 answers

How to determine if a Promise is supported by the browser

Does anyone know, using Modernizr or otherwise, if there is a way to detect if the Promise feature is enabled in a browser? I have a polyfill for the functionality, but only want to apply it if the browser does not have a native implementation.
user2836501
  • 502
  • 1
  • 4
  • 8
1
2
3
34 35