browser-detection

How do I detect whether a browser supports mouseover events?

主宰稳场 提交于 2019-11-28 08:29:00
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 supports hover events like onmouseover or onmouseout and the :hover pseudotag in CSS? Note: I know that if I'm concerned about this I should write it a different way, but I'm curious as to whether detection can be done. Edit: When I say, "supports hover events", I really mean, "does the browser have a meaningful representation of hover events". If the

How to target Windows 10 Edge browser with javascript

懵懂的女人 提交于 2019-11-28 07:13:14
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 invest a lot of time fixing the old code. sandstrom Try to detect features instead of a specific browser. It's more future-proof. Only rarely should you use browser detection. With that out of the way: one option is to use a library (there are many intricacies to User Agent strings), or alternatively to parse window.navigator.userAgent manually. Using a

jQuery - detecting the operating system and operating system version

天涯浪子 提交于 2019-11-28 06:06:50
I have been writing a userscript for the past few months, for my company, and have just designed the main site for it with installation instructions (our employees are based all around the world and very few have heard of userscripts, let alone used them, so this frontend is meant to cut down the time I spend supporting the script). What I would like to do is, on the installation page, detect which browser and OS / OS version they're using so that I can highlight the most relevant instructions slightly darker than the rest, or simply not display irrelevant sections. For example for IE6 you

Reliable Way to Detect Desktop vs. Mobile Browser [duplicate]

梦想与她 提交于 2019-11-28 06:03:14
Possible Duplicate: What is the Best way to do Browser Detection in Javascript? I'd like to essentially do the following (in JavaScript or PHP): if (desktop browser) { do x; } else { // mobile browser do not do x; } It is known that using a browser detection method is not recommended . A better solution is using a capability testing . My question is, with mobile browsers become smarter and as powerful as the desktop version, what ideally exclusive capability detection to filter the desktop from non-desktop browsers? I think reversing the conditional check i.e. if (mobile browser) {} else ...

jQuery 1.9 browser detection

生来就可爱ヽ(ⅴ<●) 提交于 2019-11-28 05:27:02
In earlier versions, I used to test if I should be triggering popstate manually on page load, because Chrome triggers it right after load, and Firefox and IE do not. if ($.browser.mozilla || $.browser.msie) { $(window).trigger('popstate'); } Now that they dropped the browser object in 1.9, how should I test for these browsers? Or how do I figure if I need to popstate on page load or not? The code is: $(function(){ $(window).on('popstate', popState); // manual trigger loads template by URL in FF/IE. if ($.browser.mozilla || $.browser.msie) { $(window).trigger('popstate'); } }); Update Went for

Detecting IE6 using jQuery.support

旧城冷巷雨未停 提交于 2019-11-28 03:20:38
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 want to do something special in case the browser does not support :hover for all elements... thus I need a way to test for this feature. (don't want to use jQuery.browser). Any ideas? While it's good practice to check for feature support rather then user agent, there's no simple way to check for something like support of a css property using

How to display browser specific HTML?

情到浓时终转凉″ 提交于 2019-11-27 23:48:05
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 <!--[if IE]> <a href"ie-only.html">click here!</a> <!--[else]> <a href"all-other-browsers.html">click here!</a> <![endif]--> I don't think this is possible with conditional comment tags (which only work in internet explorer). Plus I don't think there is an "else" statement. Is there a way to do this with javascript? Please help! Thanks! I don't think this is possible with conditional comment tags (which

Detecting mobile browsers on the web?

僤鯓⒐⒋嵵緔 提交于 2019-11-27 22:47:14
问题 I'm curious to know how to check for iPhone, iPad and other mobile browsers.(JavaScript or CSS) Edit: Not user agent string, please. That can be faked. Possible Dupes: Auto detect mobile browser (via user-agent?) and Standard way to detect mobile browsers in a web application based on the http request 回答1: Basically you check the User Agent String see http://www.hand-interactive.com/resources/detect-mobile-javascript.htm Detect iPhone: navigator.userAgent.toLowerCase().search("iphone") > -1

Using Javascript to detect Google Chrome to switch CSS

你。 提交于 2019-11-27 21:30:55
I have been playing around with different scripts, I found one that works for everything but Chrome... this is the code I have been using to differ in .CSS files. I tried just makeing the Browser name into "Chrome" But that did not work. if (browser == 'Firefox') { document.write('<link rel="stylesheet" href="../component/fireFoxdefault.css" />'); } if (browser == 'Safari') { document.write('<'+'link rel="stylesheet" href="../component/default.css" />'); } TJ. Use the following to detect chrome: var isChrome = navigator.userAgent.toLowerCase().indexOf('chrome') > -1; Source: http://davidwalsh

What is the Best way to do Browser Detection in Javascript?

China☆狼群 提交于 2019-11-27 20:56:48
In one of my Web Development classes we where asked to create a script that detects NE4,NE6+,IE4,IE6+ Browsers that display a compatable CSS script for each browser. he gave us an article to read about these and the article mentioned this site one of the students said this The best choice for javascript compatibility is to test for browser capabilities when you want to do something. One of the main reasons for this is that in the future, more and more browsers will be created. Now my questions is this which way is the best way to detect the users browser object detection or using the Navigator