51degrees c-sdk native bindings for nodejs, it help you detect devices from userAgent in high performance.
-
methodmust be one ofpatternandtrie, default value is:pattern. -
optionsmust be an object -
options.filename: your 51degrees data, lite or premium -
options.properties: required properties
for more information, you could move to 51degrees documentation
var parse = require('51degrees').parse;
var userAgent = '...' // your userAgent in any clients(browser/ios/android)
var ret = parse(userAgent, 'trie');
console.log(ret);After the above program, you will get:
{ Id: '17595-21721-21635-18092',
Canvas: true,
CssTransforms: true,
CssTransitions: true,
History: true,
Html5: true,
IndexedDB: true,
IsMobile: false,
Json: true,
PostMessage: true,
Svg: true,
TouchEvents: true,
WebWorkers: true,
method: 'trie',
data: {} }51Degrees.node exposure ALL_PROPERTIES to shortly fetch all propertites from userAgent, just using like this:
var parse = require('51degrees').parse;
var properties = require('51degrees').ALL_PROPERTIES;
var userAgent = '...' // your userAgent in any clients(browser/ios/android)
var ret = parse(userAgent, 'trie', {properties: properties});
console.log(ret);Then will prints the whole properties, it's super useful for overview of this module and 51Degrees product.
The following list shows all properties that 51degrees would export in json:
AnimationTimingBlobBuilderCanvasCssBackgroundCssBorderImageCssCanvasCssColorCssColumnCssFlexboxCssFontCssImagesCssMediaQueriesCssMinMaxCssOverflowCssPositionCssTextCssTransformsCssTransitionsCssUIDataSetDataUrlDeviceOrientationFileReaderFileSaverFileWriterFormDataFullscreenGeoLocationHistoryHtml5Html-Media-CaptureIdIframeIndexedDBIsMobileJsonLayoutEngineMaskingPostMessageProgressPromptsScreenPixelsHeightScreenPixelsWidthSelectorSvgTouchEventsTrackVideoViewportWebWorkersXhr
$ npm install 51degrees --save

