Possible Duplicate:
What is the Best way to do Browser Detection in Javascript?
I'd like to essentially do the following (in JavaScript or PHP):
if (desktop browser) {
do x;
}
else { // mobile browser
do not do x;
}
It is known that using a browser detection method is not recommended. A better solution is using a capability testing. My question is, with mobile browsers become smarter and as powerful as the desktop version, what ideally exclusive capability detection to filter the desktop from non-desktop browsers?
I think reversing the conditional check i.e. if (mobile browser) {} else ...
might prove to be more problematic, right?