browser-detection

Mobile browser detection?

寵の児 提交于 2019-11-26 19:24:31
问题 We are looking for a way to determine if a user is using a mobile browser. We need to do that in PHP, by parsing the user agent string. I know this method has got many caveats, but we really need to do it that way. Do you have any suggestion? A good (even if not perfect) updated code? I know about WURFL, and I believe it's great, but it's not free to use anymore for non open source projects. By googling a bit, I also found this code: http://mobiforge.com/developing/story/lightweight-device

Differentiate IE7 browser and browser in IE7 compatibility mode

主宰稳场 提交于 2019-11-26 18:59: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. tuomassalo For at least IE8 and IE9, you can check whether navigator.userAgent has the substring Trident in it. An IE8+ always has a Trident in its

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

纵然是瞬间 提交于 2019-11-26 17:29:59
问题 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 few properties which you can go for: window.SVGAngle for example. Is this the best way to check for SVG support? Is there any equivalent for VML? Unfortuntaly - in firefox I can quite happily do all the rendering in VML without error - just nothing

Detecting IE using jQuery

你。 提交于 2019-11-26 16:33:53
问题 $(window).load(function () { if($.browser.msie && $.browser.version=="6.0") { // do stuff } }); Just realized that $.browser has been depreciated in 1.3. What is the new method for detecting IE, specially IE6. 回答1: The jQuery documentation for jQuery.browser shows the following warning. (Emphasis is mine.) Because $.browser uses navigator.userAgent to determine the platform, it is vulnerable to spoofing by the user or misrepresentation by the browser itself. It is always best to avoid browser

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

杀马特。学长 韩版系。学妹 提交于 2019-11-26 14:28:25
问题 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 show "chrome" link; however, if someone is on Chrome for Android, it should show the "mobile-other" link. Script: <script>$(document).ready(function(){ var ua = navigator.userAgent; if (/Chrome/i.test(ua)) $('a.chrome').show(); else if (/Android

Detect Safari browser

自古美人都是妖i 提交于 2019-11-26 14:19:19
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; } david 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 } } fregante Note: always try to detect the specific behavior you're trying to fix, instead of targeting it with isSafari? As a

PHP mobile browser detection?

落花浮王杯 提交于 2019-11-26 12:43:57
问题 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 browsers, along with alternatives like Opera. I\'d like to have at least the majority of the mobile market covered , and I\'d really prefer virtually all of the market if it doesn\'t take much. 回答1: WURLF is the ultimate way for mobile browser

Browser detection

蹲街弑〆低调 提交于 2019-11-26 12:12:57
问题 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 == \"FF\")) { WebMsgBox.Show(\"1111\"); } no effects :-/ what is IE and FF types? 回答1: if (Request.Browser.Type.Contains("Firefox")) // replace with your check { ... } else if (Request.Browser.Type.ToUpper().Contains("IE")) // replace with your check {

Environment detection: node.js or browser

不打扰是莪最后的温柔 提交于 2019-11-26 12:10:59
问题 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 window was a variable only accessible on Browsers, and global in node, so I can detect in which environment the code is executing (assuming that no script declares the window variable) They are two problems. How should I detect in which browser the

Detect iPad users using jQuery?

自闭症网瘾萝莉.ら 提交于 2019-11-26 12:01:52
Is there a way to detect if the current user is using an iPad using jQuery/JavaScript? Rion Williams iPad Detection You should be able to detect an iPad user by taking a look at the userAgent property: var is_iPad = navigator.userAgent.match(/iPad/i) != null; iPhone/iPod Detection Similarly, the platform property to check for devices like iPhones or iPods: function is_iPhone_or_iPod(){ return navigator.platform.match(/i(Phone|Pod))/i) } Notes While it works, you should generally avoid performing browser-specific detection as it can often be unreliable (and can be spoofed). It's preferred to