In Web development, we have browser/feature detection libraries as a last resort for cross-browser applications. Is there any equivalent library, or at least an algorithm, for detecting the OS at runtime? Or must we compile cross-platform applications with slightly different sources for each platform?