September 03, 2018
A JS utility to probe user client for Operating System and Web browser being used and
represent it via attribute value of
<body> element and in JS via a Boolean flag.
Working on a website/webapp that supports multiple browsers across multiple OSs is a hard problem. We often end up with bugs that only affect certain browser and OS combination, and fixing these bugs often involve hacks, Eg; using specific CSS selector that is identified only by certain browsers. For instance, Browserhacks has a brief list of useful selector and JS hacks that can be used to target fixes only for certain browsers & OSs. But such hacks often come with unexpected side-effects and are also not readable or consistent if browser or OS version is changed.
Client Probe does browser and OS detection using userAgent string supplied by the browser and then adds flags as an attribute value of <body> (to use in a selector in CSS) and as a Boolean flag on provided object to use it in JS.