Most generic mobile User-Agent header string - perl

I use LWP::UserAgent to access the web site. The site offers almost the same info in auto-selected layouts for pc (default?) and mobile. Some informations are easier to get in non default layout.
Which User-Agent most generic strings are recommended to identify web client as mobile or pc device?
LWP::UserAgent : $ua->agent('…');
P.S. So far for tests I use full string of randomly selected mobile device. It works but I would like to set proper "style-guide" - set and forget for LONG. I would like to avoid requirement for fixes every few years.

In my specific case Mozilla/5.0 (Mobile) delivers wanted results.
IMHO it is worth to try in other cases.
$ua->agent('Mozilla/5.0 (Mobile)');
I have tried it based on suggestion in
https://developer.mozilla.org/en-US/docs/Web/HTTP/Headers/User-Agent
Firefox UA string
[…] The UA string of Firefox itself is broken down into four components:
Mozilla/5.0 (platform; rv:geckoversion) Gecko/geckotrail Firefox/firefoxversion
Mozilla/5.0 is the general token that says the browser is Mozilla compatible, and is common to almost every browser today.
platform describes the native platform the browser is running on (e.g. Windows, Mac, Linux or Android), and whether or not it's a mobile phone. Firefox OS phones simply say "Mobile"; the web is the platform.
[…]

Related

Mail marketer - avoid google image proxy to detect devices

I'm trying to detect the devices that open my newsletter parsing the user-agent that request my 1x1 tracking image. The problem is that Gmail save all of the images in his storage and the user agent is always "Mozilla/5.0 (Windows NT 5.1; rv:11.0) Gecko Firefox/11.0 (via ggpht.com GoogleImageProxy)", this if the opener is from the gmail app and when is from the desktop interface.
Now the question is, there's a way to tell Google avoiding to save the image in the newsletter? Maybe there's a custom header in the mail?
Or maybe there are other solutions for detecting the tipology of the devices that open newsletter from gmail official interface?
Thanks to all.
Yuri
The only solution I'm aware of is the one provided by ContactMonkey, but it's a proprietary system so I'm not sure of how it works. They have a free plan so you can test out their software and see if it fits your needs.

NGINX GeoIP and detecting mobile at server level

What I am trying to do is setup NGINX to detect specific country codes. I have this working properly right now adding in lines such as
if ($geoip_country_code = IE) { rewrite ^(.*) http://link.com/for/Ireland;
This is in my actual site config file not my nginx.conf file.
What I would like to also do is add in a mobile check to this, such as if it's Ireland AND mobile its will go to a second link. Is this even possible to do at this level? Or am I stuck just detecting the country at the server level then have to deal with mobile in a more standard way such as when the page is loading and using a mobile detection script. I know I can do it this way, but I would love to be able to add in the detection into the same catch in my NGINX config.
Thanks for all the help and information.
Take a look at http://detectmobilebrowsers.com. It has code snippet for nginx.
Recently I did such nginx configuration, works fine.
You are far better off using code redirects than nginx configuration due to the incredible difference in user-agents for mobile. In particular, the cost of invoking a serie of if statements on nginx is non-trivial.
This website has a non-exhaustive list of mobile user-agents, old and not-so-old. You'll quickly see that the list is actually quite gianormous, to say the least. Let's focus on just iPhones, iPods and iPads for now. They're pretty easy to differentiate:
Mozilla/5.0 (device type; cpu type; CPU like Mac OS X; en) AppleWebKit/420+ (KHTML, like Gecko) Version/3.0 Mobile/1A543a Safari/419.3
So, this one will not pose problem. However, the string is very similar to other things, including Safari's desktop user-agent... And this is for the easiest of phones. Android has no such simplicity. Take, for instance, the HTC Desire:
Mozilla/5.0 (Linux; U; Android 2.1-update1; de-de; HTC Desire 1.19.161.5 Build/ERE27) AppleWebKit/530.17 (KHTML, like Gecko) Version/4.0 Mobile Safari/530.17
The identifier for the OS changed to the third field, which means that you now need a minimum of two regular expression engine calls to match iPhones and some android. I'm saying some, because... Well, let's go to the Motorola Droid:
MOT-V9mm/00.62 UP.Browser/6.2.3.4.c.1.123 (GUI) MMP/2.0
...Waaat?
Conclusion: you'll need a database of user-agents if you care about false positives. If you don't, just do broad checks on nginx using regular expressions on the user-agent, searching for the keywords iPad, iPhone, iPod, Android, Windows Phone. That will flag about 80-85% of all mobile users. If you want to match everyone, you'll need to use a DB of user-agents due to manufacturers re-writing their useragents.

Is it possible to initiate a voice call from Mobile Safari to a proprietary service (i.e., not PSTN) with no plug-ins?

We assume the answer is no. However, all SO questions are either dated or based on desktop browsers.
We're aware of WebRTC, but it's not supported in Mobile Safari today. Is there any other approach?
To clarify the scenario, imagine we had a service like Skype. Instead of requiring both parties to have the app, we would like one side to use a mobile browser to have phone calls.
No, you cannot. Not without plugins. If you want to place calls from a browser to any other client, you must use WebRTC for full support (media transport + media devices access) or you have to use a plugin to access the media devices and to do the transport (e.g. Flash).
As Mobile Safari still don't have WebRTC...

How can I integrate CalDAV and CardDAV

I am trying to allow people (from a URL) to connect to a calender/contacts from their iPhone, Blackbury or Android phone - what is the best way to do this?
I've had a bit of a read and it seems that CalDAV and CardDAV are the best way to integrate calenders/contacts, but how exactly can I do this? The internet seems to lack a standard way of how you can integrate this into a number of devices.
Which mobile devices support them? And is it possible to just provide a URL and then the calender/contacts just automatically sync!?
All of this assumes you have some sort of Groupware server setup somewhere which acts as the repository for this information.
For opensource you might want to look at a product called Sogo. Apple also do a caldav/carddav server written in python. They expect you to buy a mac server but you can download the code and run it from a pc or linux box. There's a heap of paid-for groupware.
You might want to check out the "opensource" client software written by the same kids who develop Sogo caled funambol. This claims to be x-mobile (all the ones youve mentioned anyway).
The idea behind all the *DAV protocols is that yes everything is done by Uri (this was actually specced by Tim Berners Lee in his draft for the web).
I've just been through this very same process and found only emerging standards, of which *DAV are the de facto ones IMO. HTC use MS active sync on my HD2 to sync my Gmail. Go figure!
Bedework is CalDAV/CardDAV server that allows you to hook your iPhone/iCal calendar and events.
I have used it and it gives you an url to sign in with in you phone calendar. The Bedework is a server you could install on you machine (it is provided with documentation; this is a good point to start with).
Android natively does not support Bedework. In order for Android to support the CalDAV you have to install an application that supports CalDAV, but I do not know if they work with Bedewrok or not.
In the case of android you could try using the CalendarProvider and the ContactProvider. You could refer to this : http://developer.android.com/guide/topics/providers/calendar-provider.html

iPhone only server?

Is it possible to restrict access to a server so that only iPhone devices can use it? I have no experience in setting up servers or the like before. I am still very fresh to programming. Thanks.
Is this a web server you're talking about? If so, then normal web requests have a User-Agent string in the HTTP header. You can check this value to see if the request is coming from an iPhone. If it's not coming from an iphone, you can reject the request, or redirect the user to a page explaining that your website is only for iphones.
If you are developing the server and iphone software, you could use some form of simple encryption. A model like SSL may be too heavyweight, but it may be an option.