Possibility for a website to track the user's chrome extensions, or their behaviour?

馋奶兔 提交于 2019-12-06 15:56:24

No.

That would be a nasty invasion of privacy.

The closest you could come to detecting an extension would be to examine the DOM and JS environment of your page and see if the browser modified it in ways you didn't expect … but that would be a massively broad problem to solve, so you could only practically do it to look for very specific effects (which is what ad-blocker-blockers do).

For some specific extensions only, you can detect them by trying to load resources from them. This will be testing for specific extensions, and not discovering a list.

This requires you to know the extension ID, path to resource, and the resource has to be in web_accessible_resources. As the name suggests, that makes some files accessible from the web context, so you can try to load them. A network error would signify it's not installed (or no longer has that resource in web-accessible).

Again, that requires you to know the extension you're going to test for in advance, and extensions without web-accessible resources are invisible to this technique.

Notes:

  • Google Cast library uses this technique to probe if its own extension is installed.
  • If it's not, it generates a nasty error in the JS console for the failed network transfer, an error that you cannot silence from JS code — which was enough of an annoying problem that Chrome eventually added a blacklist for those console messages just so it isn't an eyesore.

From that, you can deduce it's probably not a good idea to test for a long list of extensions. It will pollute your console with errors. For cooperating extensions on pre-defined domains, there's a better way to test that it's installed. But that's not your case.

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!