首页 > 解决方案 > C# 使用进程在 Firefox 本机消息传递中不工作但在 Chrome 中工作启动 Excel

问题描述

这是我在 c# 中的主机应用程序。

已编辑:我已将示例主机应用程序代码更改为简单代码。

class Program
{
    public static void Main(string[] args)
    {
        System.Diagnostics.Process.Start(@"c:\sample.xls");
    }
}

当我的程序使用 Firefox 扩展程序运行时,excel 没有打开。如果我使用 Chrome 扩展程序,excel 将毫无问题地打开。

这是我的Firefox扩展设置: manifest.json

{
  "name": "ExcelPrint",
  "description" : "ExcelPrint",
  "version": "1.0",
  "permissions" :[
    "activeTab", "nativeMessaging", "tabs"
  ],
  "content_scripts": [
    {
      "matches": [
        "https://*/*",
        "http://*/*"
      ],
      "js": ["content.js"]
    }
  ],
  "background": {
      "scripts": [
          "background.js"
      ]
  },
  "manifest_version": 2
}

火狐:sample.excelprint.json

{
  "name": "sample.excelprint",
  "description": "ExcelPrint API Host",
  "path": "ExcelPrint.bat",
  "type": "stdio",
  "allowed_extensions": [
    "3042a0d1d72c86e7952c552c6984bbea99bc5f0e@temporary-addon"
  ]
}

这是我的Chrome扩展设置:manifest.json 与 firefox 相同

铬:sample.excelprint.json

{
  "name": "sample.excelprint",
  "description": "ExcelPrint API Host",
  "path": "ExcelPrint.bat",
  "type": "stdio",
  "allowed_origins": [
    "chrome-extension://ncdpaccgfgdcifdjlncninlegabfgkgl/"
  ]
}

需要帮助如何使用 Firefox 扩展程序打开 excel。

标签: c#firefox-addonchrome-native-messaging

解决方案


推荐阅读