GV

GeezerVison

The World Wide Web, restored to 800 pixels of glory.

Home|About|Gaming cabinet|Archives|How it works|Starter sites

On this site

  • Sign in
  • ActionsCI/CD and automation
  • CodespacesCloud development environments
  • All Features
  • Documentation
  • Training
  • Certifications
  • Build with Copilot
  • Customize Copilot
  • Integrations
  • Trending repos
  • GitHub Sponsors
  • Developer articles
  • Enterprises

This view

  • Original page
  • New address

GeezerVison is showing github.com — GitHub - skillnull/DeviceJs: JS获取设备信息(操作系统信息、地理位置、UUID、横竖屏状态、设备类型、网络状态、浏览器信息、生成浏览器指纹、日期、生肖、周几等)

BranchesTags
Open more actions menu

Latest commit

 

History

140 Commits
140 Commits

Folders and files

NameName
Last commit message
Last commit date
.github
.github
 
 
scripts
scripts
 
 
src
src
 
 
test
test
 
 
.gitignore
.gitignore
 
 
.npmrc
.npmrc
 
 
.nvmrc
.nvmrc
 
 
LICENSE
LICENSE
 
 
README.en.md
README.en.md
 
 
README.md
README.md
 
 
babel.config.json
babel.config.json
 
 
package-lock.json
package-lock.json
 
 
package.json
package.json
 
 
rollup.config.js
rollup.config.js
 
 
tsconfig.json
tsconfig.json
 
 

Repository files navigation

DeviceJs logo

轻量级 JavaScript 与 TypeScript 设备检测和浏览器环境信息工具。

npm version npm downloads build status license

简体中文 | English

功能特性

  • 检测设备、操作系统、浏览器、屏幕、网络、语言和输入能力。
  • 生成浏览器指纹和 UUID。
  • 支持公历转农历。
  • 支持浏览器、Node.js 和 SSR 环境安全调用。
  • 提供 UMD、ESM 产物和 TypeScript 类型声明。

安装

npm install @skillnull/device-js
# or
yarn add @skillnull/device-js
# or
pnpm add @skillnull/device-js

使用

import Device, { type DeviceInfo, type DeviceInfoOptions } from '@skillnull/device-js'

const options: DeviceInfoOptions = {
  info: ['deviceType', 'OS', 'browserInfo']
}

const data: DeviceInfo = await Device.Info(options)

不传参数调用 Device.Info() 时,将返回全部可用信息。

CDN

UMD:

<script src="https://unpkg.com/@skillnull/[email protected]/dist/device.js"></script>
<!-- or -->
<script src="https://cdn.jsdelivr.net/npm/@skillnull/[email protected]/dist/device.js"></script>

ESM:

<script type="module">
  import Device from 'https://unpkg.com/@skillnull/[email protected]/dist/device.es.js'

  const data = await Device.Info()
</script>

配置项

配置 类型 说明
domain string 生成浏览器指纹时使用的域名,默认为 window.location.host。
transferDateToLunar string 请求 lunarDate 时需要转换的公历日期。
info DeviceInfoKey[] 指定需要返回的字段,不传时返回全部字段。
locale 'zh-CN' | 'en-US' 文本结果使用的语言,默认为 zh-CN。
showLoading boolean 是否显示加载层,默认显示;传入 false 时关闭。

可用的 info 字段:

分类 字段
设备 deviceType, isEmulator, deviceModel, hardwareConcurrency
系统 OS, OSVersion, platform, language, timezone
屏幕与输入 screenHeight, screenWidth, viewportHeight, viewportWidth, devicePixelRatio, orientation, touchSupport, colorScheme
浏览器与网络 browserInfo, userAgent, netWork, cookieEnabled
标识与位置 fingerprint, UUID, geoPosition
日期 date, lunarDate, week

部分信息依赖浏览器支持、User-Agent 数据或用户授权。其中地理位置需要用户明确授权。

在线演示

打开 DeviceJs 在线演示。

发布

# 完整发布:同步版本、验证、推送提交与 Tag,通过 GitHub CI 后发布 npm
npm run publish

# 只验证下一版本,不提交、不推送、不发布
npm run publish -- --dry-run

发布入口会同步 package.json、package-lock.json 和中英文 README 中的版本号。发布必须从与 origin/main 一致的干净 main 分支执行。

许可证

MIT © 2019-present skillnull

About

JS获取设备信息(操作系统信息、地理位置、UUID、横竖屏状态、设备类型、网络状态、浏览器信息、生成浏览器指纹、日期、生肖、周几等)

skillnull.com/others/DeviceJs/index.html

Topics

devicedevice-infodevice-jsdevicejsjavascript

Resources

Readme
MIT license
Activity

Stars

254 stars

Watchers

3 watching

Forks

99 forks
Report repository

Releases

Used by

Contributors

Languages

You are visitor 01402503 — GeezerVison does not store the pages you look up.
Best viewed with Netscape Navigator 4.7 or Internet Explorer 6 at 800×600. No cookies required.