I am currently developing a client side application which will be designed for both, smartphones and tablets. Therefore it will get two different layout modes.
You could detect whether it is a phone using a http://detectmobilebrowser.com/ script. If not, you can assume it is a tablet (since, as you mentioned, desktop browsers are irrelevant for this app).