简体   繁体   English

检查用户安装了哪些插件

[英]Checking what plugins a user has installed

How can you find out what plugins a firefox/chrome user has installed using php? 您如何找出使用Firefox安装了firefox / chrome用户的插件? Also is it possible to find out their screen resolution? 还可以找出他们的屏幕分辨率吗?

Identifying plugins is possible but kind of messy since the information presented may not be 100% accurate. 识别插件是可能的,但由于显示的信息可能不是100%准确,因此有点混乱。 There are scripts like Slicer available to do this. 诸如Slicer之类的脚本可用于执行此操作。

You need to use Javascript to obtain the screen resolution. 您需要使用Javascript来获取屏幕分辨率。 Some googling turned up a method for doing this. 一些谷歌搜索出现了一种执行此操作的方法

If you're looking for plugins such as IRC, which have a protocol set up for it you can use something like 如果您正在寻找诸如IRC之类的插件,并且已经为其设置了协议,则可以使用类似

    try {
        window.location = "protocol://etc";
    } catch (e){
        alert("Not supported");
    }

Getting the screen resolution with php is impossible, as php is a server side language. 使用php获取屏幕分辨率是不可能的,因为php是服务器端语言。 You will need to use a client side language for this (such as javascript). 您将需要为此使用客户端语言(例如javascript)。

For this you can use 为此,您可以使用

screen.width
screen.height

With this you can send an ajax request to your server side code to keep track of this if you want! 有了这个,您可以向您的服务器端代码发送一个ajax请求,以便随时跟踪。

Edit :: For something more specific you can look at window.navigator.plugins too (firefox specific) here 编辑::对于更具体的内容,您也可以在此处查看window.navigator.plugins(特定于Firefox)

Quick google search pulled this up. 快速谷歌搜索拉起这个。

function alertSize() {
   var myWidth = 0, myHeight = 0;
   if(typeof(window.innerWidth) == 'number') {
      //Non-IE
      myWidth = window.innerWidth;
      myHeight = window.innerHeight;
   } else if(document.documentElement && (document.documentElement.clientWidth || document.documentElement.clientHeight)) {
      //IE 6+ in 'standards compliant mode'
      myWidth = document.documentElement.clientWidth;
      myHeight = document.documentElement.clientHeight;
   } else if(document.body && (document.body.clientWidth || document.body.clientHeight)) {
      //IE 4 compatible
      myWidth = document.body.clientWidth;
      myHeight = document.body.clientHeight;
  }
  window.alert( 'Width = ' + myWidth );
  window.alert( 'Height = ' + myHeight );
}

Courtesy of http://www.howtocreate.co.uk/tutorials/javascript/browserwindow http://www.howtocreate.co.uk/tutorials/javascript/browserwindow提供

You have to be careful with different browsers this function work pretty well. 您必须小心使用不同的浏览器,此功能才能很好地运行。 If you're using jQuery (and probably most other js libraries) there's a function where you could do all that in 1 line and that should be easy to find over google. 如果您使用的是jQuery(可能还有大多数其他js库),则可以使用函数在1行中完成所有操作,而在Google上应该很容易找到它。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM