ClientJS
Device information and digital fingerprinting written in pure JavaScript.
Device information and digital fingerprinting written in pure JavaScript.
ClientJS is simple. It is for finding device information and generating digital fingerprints.
ClientJS makes use of many different native JavaScript functions, methods, and opensource resources to find information about the client.
ClientJS easily lets you create a client object to find out as much useful information as you can about what devices are connecting to your site and your product. You can ask specific questions like, “does the user have an iOS or Android device?” or better yet, “is the user's device an iPad?” ClientJS even lets you produce browser/device fingerprint IDs.
Gathering information from different browsers and devices makes it difficult to handle cross compatibility. We take care of the hard stuff so that you can easily get the client info you need.
ClientJS attempts to solve the problem of making client data more easily available. Good data is necessary for good analytics that help you make better business and tech choices. Do you have good informative data about how your users connect to your site? Do you know their average screen size? ClientJS can help you collect data and make good decisions for your application and business.
1) Download. 2) Include. 3) Have Fun!
ClientJS is available via npm.
npm install clientjs
ClientJS is available as a bower package.
bower install clientjs
ClientJS is hosted on github.
Just visit our github page at https://github.com/jackspirou/clientjs and download the minified production JavaScript!
Just include the 'client.min.js' library in the beginning of your project and you can start testing for mobile devices, installed fonts, calculate browser/device fingerprints, and more!
<!DOCTYPE html>
<html lang="en">
<head>
<script src="client.min.js"></script>
</head>
<body>
...
After you have ClientJS installed, using it is simple! The first thing you need to do is create a client object and then start calling some methods.
<script>
var client = new ClientJS();
</script>
See how easy that was! Now how about we execute some methods? Let's see if we have a mobile device and if so is it an android or iOS device? If it is not, lets check if Java is installed and its version.
<script>
var client = new ClientJS(); // Create A New Client Object
if( client.isMobile() ) { // Check For Mobile Device
if( client.isMobileAndroid() ) { // Check For Android
alert('We Got Us Some Android!');
}else if( client.isMobileIOS() ){ // Check For iOS
alert('We Got Us Some Apple iOS!');
}else{
alert('Unknown Mobile Device...');
}
}else{
if( client.isJava() ) { // Check If Java Is Installed
alert('Java ' + client.getJavaVersion() ); // Get Java Version
}else{
alert('No Java Installed...');
}
}
</script>
We can can get much more info with ClientJS, but for now lets just calculate our users device/browser fingerprint.
<script>
var client = new ClientJS(); // Create A New Client Object
var fingerprint = client.getFingerprint(); // Calculate Device/Browser Fingerprint
alert( fingerprint );
</script>
Again, these are just a few examples of what you can do with ClientJS. Read about more features below:
You need these ClientJS methods to properly utilizing ClientJS.
ClientJS constructor which initiates the data and returns the client object.
<script>
var client = new ClientJS(); // Create A New Client Object
</script>
Get Software Version. Return a string containing this software version number.
<script>
var client = new ClientJS(); // Create A New Client Object
var softwareVersion = client.getSoftwareVersion(); // Get ClientJS Software Version
console.log( softwareVersion );
</script>
A device fingerprint or machine fingerprint or browser fingerprint is information collected about a remote computing device for the purpose of identification. Fingerprints can fully or partially identify individual users or devices even when cookies are turned off.
Get Fingerprint. Return a 32-bit integer representing the browsers fingerprint.
<script>
var client = new ClientJS(); // Create A New Client Object
var fingerprint = client.getFingerprint(); // Get Client's Fingerprint
console.log( fingerprint );
</script>
Get Custom Fingerprint. Take a string of datapoints and return a 32-bit integer representing the browsers fingerprint.
<script>
var client = new ClientJS(); // Create A New Client Object
var ua = client.getBrowserData().ua;
var canvasPrint = client.getCanvasPrint();
var fingerprint = client.getCustomFingerprint(ua, canvasPrint);
console.log( fingerprint );
</script>
A user agent is any software that retrieves and presents Web content for end users or is implemented using Web technologies.
Get User Agent. Return a string containing unparsed user agent.
<script>
var client = new ClientJS(); // Create A New Client Object
var userAgent = client.getUserAgent(); // Get User Agent String
console.log( userAgent );
</script>
Get User Agent Lower Case. Return a lowercase string containing the user agent.
<script>
var client = new ClientJS(); // Create A New Client Object
var userAgentLowerCase = client.getUserAgentLowerCase(); // Get User Agent String
console.log( userAgentLowerCase );
</script>
Find out the name and version of the client browser.
Get Browser. Return a string containing the browser name.
<script>
var client = new ClientJS(); // Create A New Client Object
var browser = client.getBrowser(); // Get Browser
console.log( browser );
</script>
Get Browser Version. Return a string containing the browser version.
<script>
var client = new ClientJS(); // Create A New Client Object
var browserVersion = client.getBrowserVersion(); // Get Browser Version
console.log( browserVersion );
</script>
Get Browser Major Version. Return a string containing the major browser version.
<script>
var client = new ClientJS(); // Create A New Client Object
var browserMajorVersion = client.getBrowserMajorVersion(); // Get Browser's Major Version
console.log( browserMajorVersion );
</script>
Is IE. Check if the browser is IE.
<script>
var client = new ClientJS(); // Create A New Client Object
var isIE = client.isIE(); // Check For IE
console.log( isIE );
</script>
Is Chrome. Check if the browser is Chrome.
<script>
var client = new ClientJS(); // Create A New Client Object
var isChrome = client.isChrome(); // Check For Chrome
console.log( isChrome );
</script>
Is Firefox. Check if the browser is Firefox.
<script>
var client = new ClientJS(); // Create A New Client Object
var isFirefox = client.isFirefox(); // Check For Firefox
console.log( isFirefox );
</script>
Is Safari. Check if the browser is Safari.
<script>
var client = new ClientJS(); // Create A New Client Object
var isSafari = client.isSafari(); // Check For Safari
console.log( isSafari );
</script>
Is Opera. Check if the browser is Opera.
<script>
var client = new ClientJS(); // Create A New Client Object
var isOpera = client.isOpera(); // Check For Opera
console.log( isOpera );
</script>
Is MobileSafari. Check if the browser is Mobile Safari.
<script>
var client = new ClientJS(); // Create A New Client Object
var isMobileSafari = client.isMobileSafari(); // Check For Mobile Safari
console.log( isMobileSafari );
</script>
A web browser engine, is a software component that takes marked up content and formatting information and displays the formatted content on the screen.
Get Engine. Return a string containing the browser engine.
<script>
var client = new ClientJS(); // Create A New Client Object
var engine = client.getEngine(); // Get Engine
console.log( engine );
</script>
Get Engine Version. Return a string containing the browser engine version.
<script>
var client = new ClientJS(); // Create A New Client Object
var engineVersion = client.getEngineVersion(); // Get Engine Version
console.log( engineVersion );
</script>
An operating system (OS) is a collection of software that manages computer hardware resources and provides common services for computer programs.
Get OS. Return a string containing the OS.
<script>
var client = new ClientJS(); // Create A New Client Object
var OS = client.getOS(); // Get OS Version
console.log( OS );
</script>
Get OS Version. Return a string containing the OS Version.
<script>
var client = new ClientJS(); // Create A New Client Object
var osVersion = client.getOSVersion(); // Get OS Version
console.log( osVersion );
</script>
Is Windows. Check if the OS is Windows.
<script>
var client = new ClientJS(); // Create A New Client Object
var isWindows = client.isWindows(); // Check For Windows
console.log( isWindows );
</script>
Is Mac. Check if the OS is Mac.
<script>
var client = new ClientJS(); // Create A New Client Object
var isMac = client.isMac(); // Check For Mac
console.log( isMac );
</script>
Is Linux. Check if the OS is Linux.
<script>
var client = new ClientJS(); // Create A New Client Object
var isLinux = client.isLinux(); // Check For Linux
console.log( isLinux );
</script>
Is Ubuntu. Check if the OS is Ubuntu.
<script>
var client = new ClientJS(); // Create A New Client Object
var isUbuntu = client.isUbuntu(); // Check For Ubuntu
console.log( isUbuntu );
</script>
Is Solaris. Check if the OS is Solaris.
<script>
var client = new ClientJS(); // Create A New Client Object
var isSolaris = client.isSolaris(); // Check For Solaris
console.log( isSolaris );
</script>
By Device we mean the user's personal computer. A personal computer (PC) is a general-purpose computer, whose size, capabilities, and original sale price makes it useful for individuals, and which could be a desktop, mobile, tablet, or laptop.
Get Device. Return a string containing the device.
<script>
var client = new ClientJS(); // Create A New Client Object
var device = client.getDevice(); // Get Device
console.log( device );
</script>
Get Device Type. Return a string containing the device type.
<script>
var client = new ClientJS(); // Create A New Client Object
var deviceType = client.getDeviceType(); // Get Device Type
console.log( deviceType );
</script>
Get Device Vendor. Return a string containing the device vendor.
<script>
var client = new ClientJS(); // Create A New Client Object
var deviceVendor = client.getDeviceVendor(); // Get Device Vendor
console.log( deviceVendor );
</script>
A central processing unit (CPU), also referred to as a central processor unit, is the hardware within a computer that carries out the instructions of a computer program by performing the basic arithmetical, logical, and input/output operations of the system.
Get CPU. Return a string containing the CPU architecture.
<script>
var client = new ClientJS(); // Create A New Client Object
var CPU = client.getCPU(); // Get CPU Architecture
console.log( CPU );
</script>
A mobile browser, also called a microbrowser, minibrowser, or wireless internet browser (WIB), is a web browser designed for use on a mobile device such as a mobile phone or PDA. Mobile browsers are optimized so as to display Web content most effectively for small screens on portable devices.
Is Mobile. Check if the browser is on a mobile device.
<script>
var client = new ClientJS(); // Create A New Client Object
var isMobile = client.isMobile(); // Check For Mobile
console.log( isMobile );
</script>
Is Mobile Major. Check if the browser is on a major mobile device.
<script>
var client = new ClientJS(); // Create A New Client Object
var isMobileMajor = client.isMobileMajor(); // Check For Mobile Major
console.log( isMobileMajor );
</script>
Is Mobile Android. Check if the browser is on an android mobile device.
<script>
var client = new ClientJS(); // Create A New Client Object
var isMobileAndroid = client.isMobileAndroid(); // Check For Mobile Android
console.log( isMobileAndroid );
</script>
Is Mobile Opera. Check if the browser is on an opera mobile device.
<script>
var client = new ClientJS(); // Create A New Client Object
var isMobileOpera = client.isMobileOpera(); // Check For Mobile Opera
console.log( isMobileOpera );
</script>
Is Mobile Windows. Check if the browser is on a windows mobile device.
<script>
var client = new ClientJS(); // Create A New Client Object
var isMobileWindows = client.isMobileWindows(); // Check For Mobile Windows
console.log( isMobileWindows );
</script>
Is Mobile BlackBerry. Check if the browser is on a blackberry mobile device.
<script>
var client = new ClientJS(); // Create A New Client Object
var isMobileBlackBerry = client.isMobileBlackBerry(); // Check For Mobile Blackberry
console.log( isMobileBlackBerry );
</script>
iOS (previously iPhone OS) is a mobile operating system developed and distributed by Apple Inc.
Is Mobile iOS. Check if the browser is on an Apple iOS device.
<script>
var client = new ClientJS(); // Create A New Client Object
var isMobileIOS = client.isMobileIOS(); // Check For Mobile iOS
console.log( isMobileIOS );
</script>
Is Iphone. Check if the browser is on an Apple iPhone.
<script>
var client = new ClientJS(); // Create A New Client Object
var isIphone = client.isIphone(); // Check For iPhone
console.log( isIphone );
</script>
Is Ipad. Check if the browser is on an Apple iPad.
<script>
var client = new ClientJS(); // Create A New Client Object
var isIpad = client.isIpad(); // Check For iPad
console.log( isIpad );
</script>
Is Ipod. Check if the browser is on an Apple iPod.
<script>
var client = new ClientJS(); // Create A New Client Object
var isIpod = client.isIpod(); // Check For iPod
console.log( isIpod );
</script>
An electronic visual display for computers. The screen monitor comprises the display device, circuitry and an enclosure.
Get Screen Print. Return a string containing screen information.
<script>
var client = new ClientJS(); // Create A New Client Object
var screenPrint = client.getScreenPrint(); // Get Screen Print
console.log( screenPrint );
</script>
Get Color Depth. Return a string containing the color depth.
<script>
var client = new ClientJS(); // Create A New Client Object
var colorDepth = client.getColorDepth(); // Get Color Depth
console.log( colorDepth );
</script>
Get Current Resolution. Return a string containing the current resolution.
<script>
var client = new ClientJS(); // Create A New Client Object
var currentResolution = client.getCurrentResolution(); // Get Current Resolution
console.log( currentResolution );
</script>
Get Available Resolution. Return a string containing the available resolution.
<script>
var client = new ClientJS(); // Create A New Client Object
var availableResolution = client.getAvailableResolution(); // Get Available Resolution
console.log( availableResolution );
</script>
Get Device XPDI. Return a string containing the device XPDI.
<script>
var client = new ClientJS(); // Create A New Client Object
var deviceXDPI = client.getDeviceXDPI(); // Get Device XDPI
console.log( deviceXDPI );
</script>
Get Device YDPI. Return a string containing the device YDPI.
<script>
var client = new ClientJS(); // Create A New Client Object
var deviceYDPI = client.getDeviceYDPI(); // Get Device YDPI
console.log( deviceYDPI );
</script>
In computing, a plug-in (or plugin, extension) is a software component that adds a specific feature to an existing software application. When an application supports plug-ins, it enables customization.
Get Plugins. Return a string containing a list of installed plugins.
<script>
var client = new ClientJS(); // Create A New Client Object
var plugins = client.getPlugins(); // Get Plugins
console.log( plugins );
</script>
Is Java. Check if Java is installed.
<script>
var client = new ClientJS(); // Create A New Client Object
var isJava = client.isJava(); // Check For Java
console.log( isJava );
</script>
Get Java Version. Return a string containing the Java Version.
<script>
var client = new ClientJS(); // Create A New Client Object
var javaVersion = client.getJavaVersion(); // Get Java Version
console.log( javaVersion );
</script>
Is Flash. Check if Flash is installed.
<script>
var client = new ClientJS(); // Create A New Client Object
var isFlash = client.isFlash(); // Check For Flash
console.log( isFlash );
</script>
Get Flash Version. Return a string containing the Flash Version.
<script>
var client = new ClientJS(); // Create A New Client Object
var flashVersion = client.getFlashVersion(); // GET Flash Version
console.log( flashVersion );
</script>
Is Silverlight. Check if Silverlight is installed.
<script>
var client = new ClientJS(); // Create A New Client Object
var isSilverlight = client.isSilverlight(); // Check For Silverlight
console.log( isSilverlight );
</script>
Get Silverlight Version. Return a string containing the Silverlight Version.
<script>
var client = new ClientJS(); // Create A New Client Object
var silverlightVersion = client.getSilverlightVersion(); // GET Silverlight Version
console.log( silverlightVersion );
</script>
An Internet media type is a standard identifier used on the Internet to indicate the type of data that a file contains. The identifiers were originally defined in RFC 2046, and were called MIME types because they referred to the non-ASCII parts of email messages that were composed using the MIME (Multipurpose Internet Mail Extensions) specification. They are also sometimes referred to as Content-types.
Is Mime Types. Check if mime types are installed.
<script>
var client = new ClientJS(); // Create A New Client Object
var isMimeTypes = client.isMimeTypes(); // Check For Mime Types
console.log( isMimeTypes );
</script>
Get Mime Types. Return a string containing a list of installed mime types.
<script>
var client = new ClientJS(); // Create A New Client Object
var mimeTypes = client.getMimeTypes(); // Get Mime Types
console.log( mimeTypes );
</script>
A computer font (or font) is an electronic data file containing a set of glyphs, characters, or symbols such as dingbats. Although the term font first referred to a set of metal type sorts in one style and size, since the 1990s it is generally used to refer to a scalable set of digital shapes that may be printed at many different sizes.
Is Font. Check if a font is installed.
<script>
var client = new ClientJS(); // Create A New Client Object
var font = "Times New Roman"; // Set Font String
var isFont = client.isFont(font); // Check For A Font
console.log( isFont );
</script>
Get Fonts. Return a string containing a list of installed fonts.
<script>
var client = new ClientJS(); // Create A New Client Object
var fonts = client.getFonts(); // Get Fonts
console.log( fonts );
</script>
Web storage supports persistent data storage, similar to cookies but with a greatly enhanced capacity and no information stored in the HTTP request header. There are two main web storage types: local storage and session storage, behaving similarly to persistent cookies and session cookies respectively.
Is Local Storage. Check if local storage is avaliable.
<script>
var client = new ClientJS(); // Create A New Client Object
var isLocalStorage = client.isLocalStorage(); // Check For Local Storage
console.log( isLocalStorage );
</script>
Is Session Storage. Check if session storage is avaliable.
<script>
var client = new ClientJS(); // Create A New Client Object
var isSessionStorage = client.isSessionStorage(); // Check For Session Storage
console.log( isSessionStorage );
</script>
Is Cookie. Check if cookies are avaliable.
<script>
var client = new ClientJS(); // Create A New Client Object
var isCookie = client.isCookie(); // Check For Cookies
console.log( isCookie );
</script>
Time is a dimension in which events can be ordered from the past through the present into the future, and also the measure of durations of events and the intervals between them. A time zone is a region on Earth that has a uniform standard time for legal, commercial, and social purposes.
Get Time Zone. Return a lowercase string containing the time zone.
<script>
var client = new ClientJS(); // Create A New Client Object
var timeZone = client.getTimeZone(); // Get Time Zone
console.log( timeZone );
</script>
Language preferences of client browsers.
Get Language. Return a lowercase string containing the user language.
<script>
var client = new ClientJS(); // Create A New Client Object
var language = client.getLanguage(); // Get User Language
console.log( language );
</script>
Get SystemLanguage. Return a lowercase string containing the system language.
<script>
var client = new ClientJS(); // Create A New Client Object
var systemLanguage = client.SystemLanguage(); // Get System Language
console.log( systemLanguage );
</script>
The HTML5 <canvas> element is used to draw graphics, on the fly, via scripting (usually JavaScript).
Is Canvas. Check if the canvas element is available.
<script>
var client = new ClientJS(); // Create A New Client Object
var isCanvas = client.isCanvas(); // Check For The Canvas Element
console.log( isCanvas );
</script>
Get Canvas Print. Return a string containing canvas image information.
<script>
var client = new ClientJS(); // Create A New Client Object
var canvasPrint = client.getCanvasPrint(); // Get Canvas Print
console.log( canvasPrint );
</script>
Additional details about the compiler we use, ClientJS dependencies, known issues, and our software licence.
The 'client.min.js' file is created by running the source code through the Google Closure Compiler.
Instead of compiling from a source language to machine code, the Google Closure Compiler compiles from JavaScript to better JavaScript. It parses your JavaScript, analyzes it, removes dead code and rewrites and minimizes what's left. It also checks syntax, variable references, and types, and warns about common JavaScript pitfalls.
ClientJS is completely written in JavaScript. It has no Adobe Flash, Java App, or Silverlight dependencies, but it can tell you if those browser plugins are installed and their version numbers!
ClientJS is also written in pure or native JavaScript, so that it does not rely on jQuery, MooTools, underscorejs or any other JavaScript library. This does not mean ClientJS has no dependencies at all. ClientJS does rely on multiple other open source pure JavaScript libraries, projects, and snippets. Don't worry though! All of that dependent code is hidden inside the ClientJS minified code, ‘client.min.js’ so you don’t have to include more silly stuff. The file ‘client.min.js’ has everything you need to execute any ClientJS method or calculation! :-)
Dependencies are listed below:
ClientJS is built upon and owes credit to the great work below:
There are quite a few known issues at the moment. We are working on trying to solve them instead of listing them as this project is so young. Please help us out by checking us out at github!
Just visit our github page at https://github.com/jackspirou/clientjs!