jonnnnnnnnnie
jonnnnnnnnnie

Reputation: 1239

Checking what plugins a user has installed

How can you find out what plugins a firefox/chrome user has installed using php? Also is it possible to find out their screen resolution?

Upvotes: 1

Views: 57

Answers (3)

Lienau
Lienau

Reputation: 1353

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

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.

Upvotes: 0

AlanFoster
AlanFoster

Reputation: 8306

If you're looking for plugins such as IRC, which have a protocol set up for it you can use something like

    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. You will need to use a client side language for this (such as 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!

Edit :: For something more specific you can look at window.navigator.plugins too (firefox specific) here

Upvotes: 0

Brian Lyttle
Brian Lyttle

Reputation: 14579

Identifying plugins is possible but kind of messy since the information presented may not be 100% accurate. There are scripts like Slicer available to do this.

You need to use Javascript to obtain the screen resolution. Some googling turned up a method for doing this.

Upvotes: 1

Related Questions