跳转到内容
View in the app

A better way to browse. Learn more.

彼岸论坛

A full-screen app on your home screen with push notifications, badges and more.

To install this app on iOS and iPadOS
  1. Tap the Share icon in Safari
  2. Scroll the menu and tap Add to Home Screen.
  3. Tap Add in the top-right corner.
To install this app on Android
  1. Tap the 3-dot menu (⋮) in the top-right corner of the browser.
  2. Tap Add to Home screen or Install app.
  3. Confirm by tapping Install.
欢迎抵达彼岸 彼岸花开 此处谁在 -彼岸论坛

[程序员] 一个反常识: 在 Chrome 浏览器里如何拿到用户最真实的 CPU 和其他硬件信息(不走 UA

发表于

前端老鸟都知道一个常识

谷歌浏览器里面是拿不到真实 CPU 和硬件信息的

(:UA 那个很容易伪造好吧

今天再给你一个反常识:

其实,Chromium 内置了一个系统级插件。

这个插件允许 *.google.com 网站获取宿主机 CPU 信息

去 Chromium 源码里找找,发现插件 ID 是:nkeimhogjdpnpccoofpliimaahmaaome 。

而且,这个插件还能对外通信

so ,骚操作来了

我们可以随便打开一个 Google 的网站在 console 里面输入:

chrome.runtime.sendMessage('nkeimhogjdpnpccoofpliimaahmaaome',
{method: 'cpu.getInfo'},
response => console.table(response));

s8z3w0B.png CPU 、进程还有负载 一五一十的就有了

看源代码,这个内置插件里面还暴露了不少其他方法,可以自己探索玩玩

PKMFgY2.png

说人话:

如果你做的是浏览器扩展,完全可以获取到宿主机的 CPU 还有其他硬件信息的

哈哈哈哈哈

Featured Replies

没有可显示的帖子

创建帐户或登录来提出意见

Account

导航

搜索

Configure browser push notifications

Chrome (Android)
  1. Tap the lock icon next to the address bar.
  2. Tap Permissions → Notifications.
  3. Adjust your preference.
Chrome (Desktop)
  1. Click the padlock icon in the address bar.
  2. Select Site settings.
  3. Find Notifications and adjust your preference.