browser-detection

Rails Browser Detection Methods

若如初见. 提交于 2019-11-26 11:06:14
问题 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 (X)HTML? Thanks, I\'m just wondering what everyone uses and whether there is accepted method of doing this? I know that we can get the user.agent and parse that string, but I\'m not sure if that is that is an acceptable way to do browser detection.

Mobile detection [closed]

风流意气都作罢 提交于 2019-11-26 10:58:32
问题 As it currently stands, this question is not a good fit for our Q&A format. We expect answers to be supported by facts, references, or expertise, but this question will likely solicit debate, arguments, polling, or extended discussion. If you feel that this question can be improved and possibly reopened, visit the help center for guidance. Closed 6 years ago . Is there a way to detect mobile devices using Javascript? Also, I researched that there are such an XML which contains user-agents

Jquery fail to detect IE 11

巧了我就是萌 提交于 2019-11-26 09:45:53
问题 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 instructions. I am testing in Oracle VirtualBox if it matters. The OS is Win 7. Here\'s the code: <script src=\"http://code.jquery.com/jquery-1.10.1.min.js\"></script> <script src=\"http://code.jquery.com/jquery-migrate-1.2.1.min.js\"></script> <script> var

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

狂风中的少年 提交于 2019-11-26 08:29:19
问题 In my website, I have several links like so: <a href=\"tel://+12181112222\" class=\"call\">218.111.2222</a> I want to use jQuery (or other method) to determine whether the device supports making calls / using the tel:// protocol. Does such a method exist in the world? I want to use some method for enabling or disabling the links, because when clicked on desktop we come to a page like \"Firefox doesn\'t know how to open this address, because the protocol (tel) isn\'t associated with any

What&#39;s the replacement for $.browser

丶灬走出姿态 提交于 2019-11-26 07:39:31
问题 The jQuery document tags $.browser as deprecated. So what\'s the replacement for it? 回答1: If you really need good old $.browser According to the docs, this feature was deprecated in 1.3 , and totally removed in 1.9 , although it is still available in the official jQuery Migrate plugin. If you want to do it right Depending on browser detection is not a good idea. Feature detection is the way to go (Modernizr is a great tool for that). jQuery had a $.support() method to provide some feature

Distinguish Chrome from Safari using jQuery.browser

守給你的承諾、 提交于 2019-11-26 07:31:30
问题 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)? 回答1: Since Sarfraz has not corrected his answer (thank you Sarfraz for pointing me in the correct direction), I will post functioning code here. var userAgent = navigator.userAgent.toLowerCase(); $.browser.chrome = /chrome/.test(navigator.userAgent.toLowerCase()); // Is this a version of Chrome? if($.browser.chrome){ userAgent = userAgent

Differentiate IE7 browser and browser in IE7 compatibility mode

不羁的心 提交于 2019-11-26 06:44:10
问题 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 is IE7 that browser is in IE7 compatibility mode I have the first condition working correctly as it\'s pretty much said everywhere how to do it. Not sure about the second one and/or combination of both. 回答1: For at least IE8 and IE9, you can check

reliable user browser detection with php

淺唱寂寞╮ 提交于 2019-11-26 06:35:15
问题 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 use it for outputting pertinent CSS links, for example: if(stripos($_SERVER[\'HTTP_USER_AGENT\'],\"mozilla\")!==false) echo \'<link type=\"text/css\" href=\"mozilla.css\" />\'; I noticed this question, however I wanted to clarify whether this is

Detecting iOS / Android Operating system

99封情书 提交于 2019-11-26 05:56:24
I've done some research, and this question has come up, but not in the way I intend. I'm building a page for a client that is a QR code landing, which is a place to download an application. So he doesn't have to print out 2 QR codes on a page, I'd like to detect the current operating system (Apple/Android/Other[not supported]) and modify my elements based on that value. I've looked at the script "detectmobilebrowsers" and that is just aimed at telling whether or not the user is mobile at all, whereas I would like to figure out what operating system the user is running and suggest the best

Detect Safari browser

白昼怎懂夜的黑 提交于 2019-11-26 03:08:22
问题 How to detect Safari browser using JavaScript? I have tried code below and it detects not only Safari but also Chrome browser. function IsSafari() { var is_safari = navigator.userAgent.toLowerCase().indexOf(\'safari/\') > -1; return is_safari; } 回答1: You can easily use index of Chrome to filter out Chrome: var ua = navigator.userAgent.toLowerCase(); if (ua.indexOf('safari') != -1) { if (ua.indexOf('chrome') > -1) { alert("1") // Chrome } else { alert("2") // Safari } } 回答2: Note: always try