如何在客户端系统中使用javascript检查特定软件是否已安装? [英] How to check whether specific software is installed or not using javascript in client system?

查看:152
本文介绍了如何在客户端系统中使用javascript检查特定软件是否已安装?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

是否可以使用Javascript检测客户端系统是否安装了特定的Windows应用程序?

Is it possible to detect, whether client system has specific windows application installed or not using Javascript?

我开发了一个网站,该网站只能检测由我们开发的应用程序.但我想让您知道,网站名称和Windows应用程序名称不同.我的意思是认为我的Web应用程序名称为 X ,Windows应用程序名称为 Y Skype Web应用程序 Skype Windows应用程序

I developed one website, which would have to detect the application, which was developed by us only. But I want to let you know, the website name and windows application names are different. I mean consider my web application name is X and windows application name is Y not like same as Skype webapplication and Skype windows application

考虑Skype,它具有Web应用程序和Windows应用程序.与Skype进行Windows应用程序安装检测一样,我是否也可以使用Javascript检测安装的软件.

Consider Skype, it has web application as well as windows application. As same as Skype doing the detection for windows application installation, can I also detect the software installed or not using Javascript.

我遇到了一些 StackOverflow 问题

在系统中获取已安装的应用程序

检查应用程序是否已安装

和一些在线文章

https://developers.google.com/web/updates/2017/04/getinstalledrelatedapps

https://www.codeproject.com/Questions/392194/How-can-I-check-if-a-program-is-installed-on-clien

和下面的代码一样

navigator.getInstalledRelatedApps().then(relatedApps => {
  for (let app of relatedApps) {
    console.log(app.platform);
    console.log(app.url);
    console.log(app.id);
  }
});

并且想让您知道,我使用的是 Angular 5

And want to let you know, I am using Angular 5

推荐答案

使用 getInstalledRelatedApps(),您可以

  • 更新Windows UWP应用以向其介绍您的网站,这涉及更新 Package.appxmanifest 文件.
  • <Applications>
      <Application Id="App" ... >
          ...
          <Extensions>
             <uap3:Extension Category="windows.appUriHandler">
              <uap3:AppUriHandler>
                <uap3:Host Name="example.com" />
              </uap3:AppUriHandler>
            </uap3:Extension>
          </Extensions>
      </Application>
    </Applications>
    

    1. 通过在您的/.well-known/目录中添加 windows-app-web-link 文件来更新您的网站,以了解有关Windows UWP应用的信息网络服务器.
    1. Update your website to tell it about your Windows UWP app by adding a windows-app-web-link file to your /.well-known/ directory on your web server.

    [{
      "packageFamilyName": "MyApp_9jmtgj1pbbz6e",
      "paths": [ "*" ]
    }]
    

    1. 使用Windows UWP应用程序的详细信息更新网站上的Web应用程序清单.

    {
      "related_applications": [{
        "platform": "windows",
        "id": "MyApp_9jmtgj1pbbz6e!App",
      }]
    }
    

    1. 调用 getInstalledRelatedApps()来检查您的UWP应用是否已安装:
    1. Call getInstalledRelatedApps() to check if your UWP app is installed:

    const relatedApps = await navigator.getInstalledRelatedApps();
    relatedApps.forEach((app) => {
      console.log(app.id, app.platform, app.url);
    });
    

    这篇关于如何在客户端系统中使用javascript检查特定软件是否已安装?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

    查看全文
    登录 关闭
    扫码关注1秒登录
    发送“验证码”获取 | 15天全站免登陆