user-agent

How to recognize Facebook User-Agent

馋奶兔 提交于 2019-11-26 19:59:12
When sharing one of my pages on FB, I want to display something different. Problem is, I prefer not to use the og: elements, but to recognize FB user-agent. What is it? I can't find it. Martin. For list of user-agent strings, look up here . The most used, as of September 2015, are facebookexternalhit/* and Facebot . As you haven't stated what language you're trying to recognize the user-agent in, I can't tell you more information. If you do want to recognize Facebook bot in PHP, use if ( strpos($_SERVER["HTTP_USER_AGENT"], "facebookexternalhit/") !== false || strpos($_SERVER["HTTP_USER_AGENT"]

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

Change user agent for selenium driver

折月煮酒 提交于 2019-11-26 19:20:01
I have the following code in Python : from selenium.webdriver import Firefox from contextlib import closing with closing(Firefox()) as browser: browser.get(url) I would like to print the user-agent HTTP header and possibly change it. Is it possible? There is no way in Selenium to read the request or response headers. You could do it by instructing your browser to connect through a proxy that records this kind of information. Setting the User Agent in Firefox The usual way to change the user agent for Firefox is to set the variable "general.useragent.override" in your Firefox profile. Note that

Redirect mobile devices to alternate version of my site

喜夏-厌秋 提交于 2019-11-26 18:02:52
问题 We've got an alternate version of out website ready for mobile devices. The content we serve is different and it works well. What is the best way to detect which version to serve. We don't have a list of all mobile devices so to use the user-agent header is tricky as we may miss something. We thought about useing device screen width - but what happens if the mobile device doesnt support javascript. How do we sniff this ? 回答1: You could use a device description database (such as WURFL) which

android user agent

别来无恙 提交于 2019-11-26 18:02:37
问题 I am writing an app in Android that uses a WebView to display HTML content. I was told to get an Android user agent for my app - how do I do that? I opened http://whatsmyuseragent.com from my app as well as the Android browser - both the user agents are the same. Please help! 回答1: After much research, I figured it out. There is a way to set a user agent for Android WebView. webview.getSettings().setUserAgentString("user-agent-string"); http://developer.android.com/reference/android/webkit

How to get user agent in PHP

谁都会走 提交于 2019-11-26 17:44:58
问题 I'm using this JS code to know what browser is user using for. <script> document.write(navigator.appName); </script> And I want to get this navigator.appName to php code to use it like this: if ($appName == "Internet Explorer") { // blabla } How can I do it? 回答1: Use the native PHP $_SERVER['HTTP_USER_AGENT'] variable instead. 回答2: You could also use the php native funcion get_browser() 回答3: You can use the jQuery ajax method link if you want to pass data from client to server. In this case

Why do Chrome and IE put “Mozilla 5.0” in the User-Agent they send to the server? [duplicate]

↘锁芯ラ 提交于 2019-11-26 17:18:50
This question already has an answer here: Why do all browsers' user agents start with “Mozilla/”? 6 answers When I myself send many requests to the server I found it amazing that in IE if I choose opera user string that the value of user string was User-Agent Opera/9.80 (Windows NT 6.1; U; en) Presto/2.2.15 Version/10.00 But if I choose another browser in Internet Explorer that it puts Mozilla 5.0 in the user string first. When I send the ajax request from Chrome that I found same thing that they put user string Mozilla/5.0 (Windows; U; Windows NT 6.1; en-US) AppleWebKit/534.20 (KHTML, like

How to detect iOS 6 and all minor versions by user agent?

折月煮酒 提交于 2019-11-26 16:46:13
问题 How to detect iOS 6 and all minor versions by user agent with a simple regex or something? Would be nice to distinct between iphone and ipad as well. This question differs from What is the iOS 6 user agent string? since I wanted help in building a regex based on the information I already know (which can be found in the linked question) 回答1: CHANGELOG 20/01/2017 UA strings update: 141 matching, 0 partially matching, and 797 invalid lines "Mobile Safari 1.1.3 (iPhone U; CPU like Mac OS X; en)"

Looking for a Java User Agent String Parser [closed]

情到浓时终转凉″ 提交于 2019-11-26 15: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 . Does anyone know of a great library in java for parsing user agent strings? We have written a custom one, but this seems like a common

Parsing HTTP User-Agent string

只谈情不闲聊 提交于 2019-11-26 15:51:41
问题 What is the best method to parse a User-Agent string in Python to reliably detect Browser Browser version OS Or perhaps any helper library that does it 回答1: Answering my own question ;) Finally I decided to go by suggestion#1 i.e. write your own. And I am happy with the outcome. Please feel free to use/modify/send me patch etc. It's here -> http://pypi.python.org/pypi/httpagentparser 回答2: UASparser for Python by Hicro Kee. Auto updated datafile and cache from remote server with version