FAQ Database Discussion Community


Detect Chrome iPhone 6+

jquery,ios,user-agent,detect,iphone-6-plus
I used to use: (window.navigator.userAgent.indexOf('Android') > -1 && (/Chrome\/[.0-9]*/).test(window.navigator.userAgent)) || navigator.userAgent.match('CriOS'); to detect Chrome on iOS devices, but it appears the user agent on Chrome for the 6+ is: Mozilla/5.0 (Macintosh; Intel Mac OS X 10_7_3) AppleWebKit/534.53.11 (KHTML, like Gecko) Version/5.1.3 Safari/534.53.10 (000578) I've also used device.js in the past...

Generate Get Request with No User Agent

asp.net,.net,google-chrome,browser,user-agent
I have a website that has been experiencing errors because of null references due to poorly coded logic regarding the user agent. Basically, there has been a slew of incoming requests that contain no user agent which leads to null reference exceptions in the user agent tracking. (It contained a...

Get User-Agent and IP Address of object anonymously uploaded to S3?

amazon-web-services,amazon-s3,ip-address,user-agent
Is there a way to retrieve the User-Agent and/or IP Address of the client that uploaded an object anonymously to an S3 bucket? I'm using an anonymous upload method similar to this: https://gist.github.com/jareware/d7a817a08e9eae51a7ea which shows a method of testing against the client's User-Agent (via. aws:UserAgent in a StringNotEquals block in...

googlebot reading site in incorrect language

mediawiki,user-agent,googlebot
My site was hacked and the useragent is sending googlebot the incorrect page. It looks like it is reading it the wrong language as a result of the extra code: dir="ltr" lang="ja" xml:lang="ja"> <head> <meta http-equiv="Content-Type" http-equiv="content-type" content="text/html; charset=UTF-8" /> I can't find where the code is in the files....

How to redirect requests / proxy based on User-Agent (mobile and desktop) using Grunt or Node server?

node.js,proxy,gruntjs,user-agent,grunt-contrib-connect
I'm using Grunt and its proxying library grunt-connect-proxy. I have two servers setup for the desktop and mobile versions of my site (both of which have separate assets and such, hence the separation). Both sites are hosted on 0.0.0.0 but on different ports (9000 and 10000). How can I proxy...

How to compare string to String Array in C#?

c#,compare,user-agent,string-comparison
I have an string; String uA = "Mozilla/5.0 (iPad; CPU OS 8_2 like Mac OS X) AppleWebKit/600.1.4 (KHTML, like Gecko) Mobile/12D508 Twitter for iPhone"; String[] a= {"iphone","ipad","ipod"}; It must return ipad because ipad is in the first match ipad at the string. In other case String uA = "Mozilla/5.0 (iPhone/iPad;...

Redirect based on operating system

javascript,wordpress,redirect,user-agent
I'm new here and I apologize if this question is basic/stupid. I am not too familiar with coding, so please excuse my ignorance/glaring errors. I have tried to put this together using code snippets found online and luckily I don't have to code too much for this project. I am...

Perform a search using JSoup

java,html,jsoup,user-agent
Since the Soundcloud Java API is discontinued, I want to perform a search on their site using JSoup. I am currently using this code: Document doc = Jsoup .connect("https://soundcloud.com/search?q=deep%20house") .userAgent("Mozilla/5.0 (Windows NT 6.1) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/41.0.2228.0 Safari/537.36") .timeout(5000).get(); But the webpage is giving me a message that I...

Check if mobile or not based on User Agent string [closed]

java,user-agent
One way to check could be based on the device width, but that definitely is not concrete. Are there any UA parsers/libraries to help identify this based on user agent string? Thanks!...

Can $_SERVER['HTTP_USER_AGENT'] contain '+' symbol?

php,user-agent
I was wondering if $_SERVER['HTTP_USER_AGENT'] can output user agents with a + instead of a space. I'm seeing a lot of votes being made in the voting system of my website, using a plus in the user agent, such as: Mozilla/5.0+(Windows+NT+6.2;+WOW64;+rv:33.0)+Gecko/20100101+Firefox/33.0 Mozilla/5.0+(Windows+NT+5.1;+U;+en)+Presto/2.10+Version/11.60 I suspect that this is some sort of...

Prevent User Agent malicious code with PHP [closed]

php,wordpress,security,wordpress-plugin,user-agent
I have this PHP code, for a Wordpress plugin. How can I prevent user agent malicious code injection? I added if (preg_match('/script/',$agent)) { $agent = preg_replace('#<script(.*?)>(.*?)</script>#is', '', $agent); for prevent only javascript malicious code, but is not enough for the other attacks. Someone suggested me to encode the html entities...

Testing for user agent spoofing in python

python,user-agent
I'm new to python and using python 3. I'm trying to download a webpage and what I want to know is if there is a way to actually see the name of the user agent the way a system admin or google sees it. In my code I download and...

List of User-agent for browser

c#,user-agent
Where can I find list of User-Agent which I can use in: webBrowser1.Navigate("http://localhost/run.php", null, null, "User-Agent: Here Put The User Agent"); Thank you for your reply....

Change UserAgentString with Selenium Chrome

google-chrome,selenium,webdriver,user-agent
How do I, using Selenium (Python), change the UAS (User Agent String) on a webdriver.Chrome() Instance? I do automated tests, and use more than just Firefox. With firefox my quest is simple, but to get the same result on Chrome, i am at a loss....

How to set User Agent in QtWebEngine QML application

qt,qml,qt5,user-agent,qtwebengine
NOTE: I was able to do that on QtWebKit QML using the QtWebView extension. Here I am interested in using QtWebEngine. My simple test application import QtQuick 2.1 import QtQuick.Controls 1.1 import QtWebEngine 1.0 ApplicationWindow { width: 800 height: 600 color: "lightgray" visible: true WebEngineView { id: webview url:...

ASP.Net WebAPI has different content type in different user agents

c#,asp.net,rest,asp.net-web-api,user-agent
I am trying to learn ASP.Net WebAPI, and I am having a hard time figuring out what is going on. I created a small application that contains an action like this: public IHttpActionResult Hello() { return Ok("Hi"); } This works fine, so I look at it in the browser. I...

how to use Piwik device detector in php project?

php,user-agent,piwik
i want to use php device detector that is part of famous Piwik project, but i can't understand how to include and use the code in my php code? i don't want to use composer. i wrote: <?php include 'DeviceDetector.php'; use DeviceDetector\DeviceDetector; use DeviceDetector\Parser\Device\DeviceParserAbstract; $dd = new DeviceDetector($_SERVER['HTTP_USER_AGENT']); $dd->parse(); $clientInfo...

About Airbnb video jumbotron for iPad

javascript,css,html5,frontend,user-agent
When visiting Airbnb from PC/MAC browsers, the homepage jumbotron will use HTML5 video as background even you resize browser to a quite small size (meaning it's not just media query). But when you use a tablet like iPad, the jumbotron will use image carousel instead. Is it something like user...

urllib2 request returns a different page about 1 in 5 times

python,request,urllib2,user-agent
import urllib2 req = urllib2.Request('http://www.amazon.com/Sweet-Virgin-Organic-Coconut-13-5oz/dp/B00Q5CIL4Y', headers={ 'User-Agent': 'Mozilla/5.0' }) html = urllib2.urlopen(req).read() print len(html) That's the smallest example I can make. If you run that then ~1 in 5 times the length of the response will be 5769, and the other times it will be a normal usable response. Whats...

HTML - How to show different image in different user agents?

javascript,html,user-agent
If I use Chrome I want to show img1.jpg (<img src="img1.jpg" alt="my Chrome Image">). Otherwise, if I use IE, I want to show img2.jpg (<img src="img2.jpg" alt="my IE Image">). Is it possible? Thanks in advance....

Change user agent for selenium driver

python,selenium,http-headers,user-agent
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?...