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
34
votes
8 answers

Detecting IE6 using jQuery.support

Anyone have any ideas on how to test for something specific for IE6 (and not IE7) using jquery.support? My problem is that IE6 supports :hover psuedo-class only for anchor elements and IE7 does support it for all elements (as FF, Chrome, etc). So I…
Jaime
  • 6,736
  • 1
  • 26
  • 42
34
votes
15 answers

What is better: CSS hacks or browser detection?

Commonly when I look around the Internet, I find that people are generally using CSS hacks to make their website look the same in all browsers. Personally, I have found this to be quite time consuming to find all of these hacks and test them; each…
Darryl Hein
  • 142,451
  • 95
  • 218
  • 261
33
votes
2 answers

How do you detect between a Desktop and Mobile Chrome User Agent?

For a Chrome Desktop Extension home page, I'm trying to detect whether a user is using Chrome for Desktop or Chrome for Mobile on Android. Currently the script below identifies Android Chrome the same as Desktop chrome. On desktop Chrome it should…
turmeric
  • 535
  • 2
  • 7
  • 16
31
votes
3 answers

Is server-side user agent detection/sniffing bad?

Client-side user agent detection is known to be bad and discouraged in favor of feature detection. However, is it also bad to react differently based on the incoming user agent field in a HTTP request? An example would be sending smaller or larger…
Raynos
  • 166,823
  • 56
  • 351
  • 396
31
votes
7 answers

Distinguish Chrome from Safari using jQuery.browser

It seems jQuery.browser is able to identify webkit rather easily as of 1.4. But how can I use it to distinguish Chrome from Safari (and visa-versa)?
kingjeffrey
  • 14,894
  • 6
  • 42
  • 47
29
votes
9 answers

Mobile detection

Is there a way to detect mobile devices using Javascript? Also, I researched that there are such an XML which contains user-agents that could help to identify the mobile handsets.
V2boni
28
votes
10 answers

If Browser is Internet Explorer: run an alternative script instead

I'm using an image carousel script that is quite heavy on the browser. It works great in Opera and Chrome, half decent in FF and absolutely breaks my balls in IE. So i'd like to give IE users an alternative of simple HTML without any action/JS. The…
dimmy4
  • 307
  • 1
  • 3
  • 5
28
votes
5 answers

Jquery fail to detect IE 11

Just stumbled upon an issue. When trying to detect IE 11 (the beta version currently on air) using Jquery, the result is 'firefox'. The same code detect IE 10. I need to know what browser the user is using in order to display different…
Ehud Grand
  • 3,501
  • 4
  • 33
  • 52
27
votes
3 answers

How do I detect IE and Edge browser?

Can't get Parallax working properly in IE or Microsoft Edge. I've looked in forums and haven't found a solution to the problem. I've come up with hopefully a solution for now. I want to make a message appear if the user is using IE or Edge. Not sure…
Brent Nicolet
  • 345
  • 1
  • 5
  • 9
26
votes
10 answers

Zepto fallback to jQuery

I'm using ZeptoJS for my web app, but I'd like to fall back to jQuery if the browser doesn't support Zepto. Since IE is the only major browser not supported at the moment, I'm tempted to detect IE: if(navigator.appName == 'Microsoft Internet…
jos3000
  • 263
  • 1
  • 3
  • 5
25
votes
2 answers

Is it possible to detect Firefox users in pure CSS?

Is it possible to detect Firefox Browser only with CSS like IE? for example, IE browser can be detected like: Can be Firefox browser detected like this code?
zur4ik
  • 6,072
  • 9
  • 52
  • 78
25
votes
16 answers

How to do browser detection with jQuery 1.3 with $.browser.msie deprecated?

How should browser detection be done now that jQuery 1.3 has deprecated (and I'm assuming removed in a future version) $.browser.msie and similar? I have used this a lot for determining which browser we are in for CSS fixes for pretty much every…
Darryl Hein
  • 142,451
  • 95
  • 218
  • 261
25
votes
5 answers

How should I be setting browscap.ini file

I downloaded the browscap.ini file and then pasted it to the directory "C:\wamp\bin\php\php5.4.3\extras" and i went to php.ini file and made these changes there: [browscap] ; http://php.net/browscap browscap = extras/browscap.ini and then i…
Nicholas Wild
  • 629
  • 1
  • 6
  • 17
23
votes
4 answers

Use jQuery to detect whether a device can make telephone calls (supports "tel://" protocol)

In my website, I have several links like so: 218.111.2222 I want to use jQuery (or other method) to determine whether the device supports making calls / using the tel:// protocol. Does such a method…
Patrick Moore
  • 13,251
  • 5
  • 38
  • 63
22
votes
4 answers

How to detect "Google Chrome" as the user-agent using PHP?

I'm interested to know whether the user-agent is "Chrome" at the server end using PHP. Is there a reliable regular expression for parsing out the user-agent string from the request header?
Zubin
  • 1,015
  • 1
  • 9
  • 15
1 2
3
34 35