0

I have this webpage, and there are some extensions which aren't exactly compatible with it (Grammarly for instance). I want to check if it is installed, and show a popup. I was using this locally and it works flawlessly:

$count = 0;
$page = "manifest";
for ($i = 0; $i<count($id); $i++){
    $path = '/.config/google-chrome/Default/Extensions/'.$id[$i].'/*/';
    $file = glob($path.$page.'.json');
    while ((strpos($file[0], $page) == false) and ($count != 10)) {
        $path = '/*' . $path;
        $file = glob($path.$page.'.json');
        $count++;
    }
    $json_a = json_decode(file_get_contents($file[0]), true);
    $name[$i] = $json_a["name"];

(below this I show the result in a popup etcetera, not relevant)

Thing is, this won't work from a server, because that file is local. Is there a way to use this on a server or any other way to check if a certain extension is installed using only PHP?

Nisse Engström
  • 4,738
  • 23
  • 27
  • 42
  • 1
    You want `access` to the `filesystem` of an `user-client`? And this `access` should come from `php` running on a `web-server`? – JustOnUnderMillions Jan 30 '17 at 14:27
  • Exactly, but any solution using php is greatly welcomed as well. I asked about the filesystem cause that's what my code did. – Matias Rozenblum Jan 30 '17 at 14:35
  • 1
    Thing you dont get it: You try to violate user privacy, when you want to access the filesystem of an user-client! This can be done with javascript, but javascript would ask the user to access this and have to allow it. like the browser is asking for webcam access. – JustOnUnderMillions Jan 30 '17 at 14:38
  • Are you looking for a way to check if a user visiting your page has a certain extension installed on his/her chrome? – EhsanT Jan 30 '17 at 14:41
  • Okay, fair point, since I tested it locally and it worked...lol. The whole point was to make a php service that could detect any extension given its id. Is such a thing possible? – Matias Rozenblum Jan 30 '17 at 14:41
  • You only can combine stuff like `php , javascript and ajax` and the user have to allow the filesystem access if no other way is possible to detect extentions. http://stackoverflow.com/questions/9309068/chrome-extension-how-to-detect-if-an-extension-is-installed-using-content-scrip im out – JustOnUnderMillions Jan 30 '17 at 14:43
  • Okay, but that is for your own extension, that's not my case, the webpage is mine, not the extension. – Matias Rozenblum Jan 30 '17 at 14:47
  • Related: [Can websites tell what addons are installed in a Firefox web browser?](//stackoverflow.com/q/39319204) – Makyen Jan 30 '17 at 16:17

0 Answers0