You may also want to separate versions by providing different URLs (table.site.com, m.site.com and site.com) for a set of reasons. Usually, you can accomplish this using two approaches (server-side detection based on user agent or client-side detection based on features).
Device.js is a starting point for doing semantic, media query-based device detection without needing special server-side configuration, saving the time and effort required to do user agent string parsing. The library is very easy to use and all you have to do is include device.js in every version of the web application and write some media query code like so (see example below). You can also trigger different dives easily.