0.0.3 • Published 5 months ago
@substrate-system/report v0.0.3
report
Get browser & OS info. Based on keithws/browser-report.
Install
npm i -S @substrate-system/report
Modules
This exposes ESM and common JS via
package.json exports
field.
ESM
import { report } from '@substrate-system/report'
Common JS
const { report } = require('@substrate-system/report')
pre-built JS
This package exposes minified JS files too. Copy them to a location that is accessible to your web server, then link to them in HTML.
copy
cp ./node_modules/@substrate-system/report/dist/index.min.js ./public/report.min.js
HTML
<script type="module" src="./report.min.js"></script>
Use
import { report } from '@substrate-system/report'
report()
// => { browser: ... }
This will return an object like this:
{
"browser": {
"name": "Chrome",
"version": "133.0.0.0"
},
"viewport": {
"width": 1074,
"zoom": 1,
"height": 587,
"layout": {
"width": 1074,
"height": 587
}
},
"cookies": true,
"os": {
"name": "macOS",
"version": "10.15.7"
},
"screen": {
"width": 1440,
"height": 900,
"colors": 30,
"dppx": 2
},
"lang": [
"en-US",
"en"
],
"timestamp": "Sun Mar 02 2025 22:47:36 GMT-0800 (Pacific Standard Time)"
}