how can i detect if someone visits my website using safari or iexplorer via their mobiles? i think the answer may be using the USER_AGENT variable, but i'm not really sure, so if you have a better idea or already a code running it would be just great to share :)
Have you looked into the browscap extension?
I use it with great success for detecting iPhone / other mobiles.
http://browsers.garykeith.com/downloads.asp
The downside is that you need to manually update it from time to time (every couple of months or so)
or phpbrowscap if you dont have access to install extensions:
I can see that there two parts to this question
What fields do we use to detect the device type
- User Agent Header
- UAProf
How do we use these fields to find out the device type and the device characteristics.
For this you should have a device database that stores a mapping between the above mentioned fields and the corresponding device characteristics and also have an efficient algorithm to query this database.
Following could be your solutions.
build in house database and data access library ( cons re-inventing the wheel, problems with updating the database as and when new device come to the market, which
practically is everyday )WURFL ( pros contains both database and access library, open source, free, used to be the defacto standard till a few years ago and is very mature, cons is not always upto date)
Device Atlas from .Mobi ( pros uptodate, has efficient data access library, provides a wide range of device characterestics, IMHO best option | cons paid )
BTW, Which language are you using to build you website ?
btw - If you are using PHP for development, check out this link - Device detection using Device Atlas and PHP