As I am recoding my entire website, I need to choose a couple of methods to detect both web browsers and mobile devices. From the lists below, could you please recommend the better option?
Here are my choices;
Browser Detection
- Use IE-specific comment arguments to target IE6 - IE8 CSS files; IE9+ and other browsers will use the same CSS file
- Web browser user agent string matches via PHP (not entire user agent strings!)
Mobile Device Detection
- CSS3 media queries, although this could be problematic for IE versions that don't support them, and also for detecting mobile devices with resolutions capable of displaying the full website (such as a 4.7" 1080p display, or a 7" 1080p display)
- User agent string matches via PHP (again, not entire strings!)
Ideally, I'd like all mobile devices (smartphones and tablets) to display the mobile version of the website, and be given the option to view the desktop version via a user agent switch, which I know Chrome, Firefox and Opera on Android offer (at the very least).
Thank you.