1.2.1 • Published 9 years ago
whoami.js v1.2.1
whoami.js
A simple and lightweight browser detection and logger library.
See demo page
Usage
// initialize whoami
var me = new whoami( [options] [, callback] );
// capture
me.execute();The callback argument gets a data object with all catched informations.
Configuring whoami to communicate via API
// initialize whoami
var me = new whoami( urlApi [, options] [, callback] );
// capture
me.execute();The callback argument gets 2 arguments:
- An
errorwhen applicable (usually from XHR request) - A
dataobject
See a server example using express.js
Options
| name | type | default | description |
|---|---|---|---|
| basic | boolean | true | Basic browser informations (document title and url, user-agent, resolution, origin url and time) |
| console | boolean|object | false | Catch all console output. You could customize which method will be subscribed using options, eg.: {warn: true, log: false} |
| context | object | {} | Set application context, like as userId, userEmail, etc |
| cookie | boolean | false | Catch all cookies from domain |
| error | boolean | false | Catch all exceptions raised on the page |
| functions | object | {} | Execute custom functions on capture and catch the return values. The functions could be sync/async using callback. You could create feedbacks prompts, check a ping using XHR request, etc |
| localStorage | object | false | Catch all the localStorage data from domain |
| screenshot | boolean | false | Capture a screenshot using the html2canvas. It will returns a Data URI containing a representation of the image in jpg format |
| sessionStorage | boolean | false | Catch all the sessionStorage data from domain |
| shortcut | boolean | true | Bind the Ctrl+0 shortcut on keyboard to execute whoami.execute() |
Thank You
With special thanks to BrowserStack for providing cross browser testing.