What is the best way to check if the user is using a mobile browser? I have seen some code, is the best way really thousands of if(…|| …||) statements or is there a good api, if so which api does the job best(and for free preferably). Thanks in advance.
p.s. Am using c#, asp.net 3.5.
The best thing to do it actually not detect the browser. The number of browsers available, along with their various versions (and the likelihood of more coming along) means it isn’t really practical to do. Even the number of devices has rocketed now that there are phones, tablets, netbooks and computers of all sizes.
So instead of detecting a browser, grab the resolution of the device and use that… i.e. “This device is small, medium or large”.
If you need this information for document style, you can use device stylesheets.