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
15
votes
4 answers

How can I target text-based browsers?

I'd like to include mark-up that makes it easier for users of text-based browsers (links, elinks, lynx) to consume my site. I'll be able to serve this special version of the site based on useragent, however what mark-up features do text-based…
Matthew
  • 11,203
  • 9
  • 38
  • 44
14
votes
5 answers

How do I detect whether a browser supports mouseover events?

Let's assume I have a web page which has some onmouseover javascript behaviour to drop down a menu (or something similar) Obviously, this isn't going to work on a touch device like the iPad or smartphones. How can I detect whether the browser…
Damovisa
  • 19,213
  • 14
  • 66
  • 88
14
votes
2 answers

Detect if event listener is supported

Is it possible to detect if certain events are supported in certain browsers? I can detect if the browser supports document.addEventListener, but I need to know if it supports the event DOMAttrModified. Firefox and Opera support it, but Chrome and…
Ben
  • 5,117
  • 2
  • 27
  • 26
14
votes
6 answers

Browser & version in prototype library?

I am used to using Atlas. Recently i have started transitioning to jQuery and sometimes prototype. The project that i'm currently working on is using prototype. In Prototype, is there an easy way to get the browser name and version? I've looked over…
EvilSyn
  • 2,412
  • 7
  • 24
  • 22
14
votes
2 answers

HttpServletRequest#getHeader("User-Agent") returns null browser name

I'm using Java 6. I have very less knowledge of JSP and Servlets. I'm using the following code to get browser name in which my application is running: String browserName = requestProvider.get().getHeader("User-Agent"); Also I'm using the following…
RAS
  • 8,100
  • 16
  • 64
  • 86
14
votes
3 answers

Blocking modern IE?

Blocking IE is definitely not best practice, but it's something in my requirements for an existing application. What's the most effective way to do that since conditional comments aren't available in IE 10? For IE 9 and below this will work:…
blong
  • 2,815
  • 8
  • 44
  • 110
14
votes
5 answers

Differentiate IE7 browser and browser in IE7 compatibility mode

Can I differentiate if client's browser is IE7 or e.g. IE9 in IE7 compatibility mode? I'm trying to figure out if I can do a JS check on my site which would recognize two different things and do different stuff depending on the result that browser…
13
votes
3 answers

How do I programmatically detect how a browser handles window.close()?

Different web browsers handle the window.close() function differently. IE prompts the user for confirmation, while Firefox and Safari just fail to honor it unless the window was originally opened with Javascript and display a message saying as much…
13
votes
1 answer

Target IE7 with jQuery

I am trying to target IE7 with an if statement in a jQuery function. My code to this specific bit is: if($.browser.msie && $.browser.version.substring(0) == "7") { //Do something } Is this correct?
mtwallet
  • 5,040
  • 14
  • 50
  • 74
13
votes
10 answers

PHP mobile browser detection?

I'm in need of a way to detect mobile browsers server-side. I'd like a way that requires me to do little to set up and little to maintain, yet still provide me with accurate detection of (at the VERY least) Android, Mobile Safari and Blackberry…
Trey Keown
  • 1,345
  • 3
  • 16
  • 23
13
votes
3 answers

Detect if Chrome browser installation is 64-bit

I am trying to perform a script that should run only on Chrome 64-bit version browsers. Is there a way to check using JavaScript if the Chrome version installed on a user's machine is 64-bit or 32-bit? t should be browser-specific, because for…
12
votes
9 answers

How to display browser specific HTML?

I'm trying to find a way to display one link to an IE user and another link to all other browsers using javascript or conditional comments (or whatever it takes). Basically... //pseudo code