npm package discovery and stats viewer.

Discover Tips

  • General search

    [free text search, go nuts!]

  • Package details

    pkg:[package-name]

  • User packages

    @[username]

Sponsor

Optimize Toolset

I’ve always been into building performant and accessible sites, but lately I’ve been taking it extremely seriously. So much so that I’ve been building a tool to help me optimize and monitor the sites that I build to make sure that I’m making an attempt to offer the best experience to those who visit them. If you’re into performant, accessible and SEO friendly sites, you might like it too! You can check it out at Optimize Toolset.

About

Hi, 👋, I’m Ryan Hefner  and I built this site for me, and you! The goal of this site was to provide an easy way for me to check the stats on my npm packages, both for prioritizing issues and updates, and to give me a little kick in the pants to keep up on stuff.

As I was building it, I realized that I was actually using the tool to build the tool, and figured I might as well put this out there and hopefully others will find it to be a fast and useful way to search and browse npm packages as I have.

If you’re interested in other things I’m working on, follow me on Twitter or check out the open source projects I’ve been publishing on GitHub.

I am also working on a Twitter bot for this site to tweet the most popular, newest, random packages from npm. Please follow that account now and it will start sending out packages soon–ish.

Open Software & Tools

This site wouldn’t be possible without the immense generosity and tireless efforts from the people who make contributions to the world and share their work via open source initiatives. Thank you 🙏

© 2026 – Pkg Stats / Ryan Hefner

whatdevice

v3.1.0

Published

上网设备检测及处理。支持自动检测并跳转到手机网站或电脑网站,是否手机或电脑访问,是否微信访问,是否微信小程序访问等功能。

Readme

上网设备检测及处理

NPM version
一个JS文件,支持自动检测并跳转到手机网站或电脑网站,是否手机或电脑访问,是否微信访问,是否微信小程序访问等功能。

whatdevice.min.js 是压缩后的代码(正式环境建议使用,省一点带宽)
whatdevice.js 是源代码

参与开发

注册并登录 GitHub 帐号,fork 本项目进行参与开发。
更多细节请参考《GitHub 上如何参与开源》这篇文章。

演示

访问网址:https://wuyumin.github.io/whatdevice/docs/example.html
扫描二维码
二维码

如何使用

建议将代码放在网页代码的 head 区

第1步:加载 JS 文件(注:GitHub 链接不稳定,请使用你的 whatdevice.min.js 资源路径)

<script src="https://wuyumin.github.io/whatdevice/whatdevice.min.js"></script>

第2步:使用对应的方法

<script>

//跳转到手机网站(在电脑网页里使用)
//特殊情况:当前访问的URL传递参数itsme=1就不跳转了
whatdevice.go2mob('手机网站网址');

//跳转到电脑网站(在手机网页里使用)
//特殊情况:当前访问的URL传递参数itsme=1就不跳转了
whatdevice.go2web('电脑网站网址');

//识别手机或电脑
if(whatdevice.isMobile){
    //手机
}else{
    //电脑
}

//识别微信访问
if(whatdevice.isWechat){
    //微信
}

//识别微信小程序
if(whatdevice.isMiniProgram){
    //微信小程序
}

//识别手机
if(whatdevice.isMobile){
    alert('你是手机访问的');
}

//识别苹果手机
if(whatdevice.isiOS){
    alert('你是苹果手机');
}

//识别安卓手机
if(whatdevice.isAndroid){
    alert('你是安卓手机');
}

//识别电脑
if(!whatdevice.isMobile){
    alert('你是电脑访问的');
}

</script>