【问题标题】:Chrome Extension: Getting error: Unrecognized manifest key 'start_url'Chrome 扩展程序:出现错误:无法识别的清单键“start_url”
【发布时间】:2018-06-07 14:44:54
【问题描述】:

使用 Chrome 扩展程序并创建 manifest.json 文件

根据 Chrome 文档,“start_url”存在(并记录在案)https://developers.google.com/web/fundamentals/web-app-manifest/#start-url

但我收到错误“无法识别的清单密钥 'start_url'”。显然,我可以删除该密钥并“修复”错误,但我希望能够“告诉浏览器您的应用程序在启动时应该从哪里开始……将用户直接引导至您的应用程序,而不是产品登录页面.想想用户打开你的应用后想要做什么,然后把它们放在那里”(这就是 start_url 键应该做的)

是否有另一种未记录的方法来实现这一点?我的语法有什么错误吗?

  {
    "start_url": "/start", // the page I want the app to open on
    "manifest_version": 2,
    "name": "My Extension",
    "description": "A fantastic extension",
    "short_name": "Extension",
    "version": "1.0",
    "background": {
      "scripts": [
        "events.js"
      ],
      "persistent": true
    },
      "browser_action": {
      "default_popup": "index.html",
      "default_title": "Extension"
    },
    "content_scripts": [
      {
        "matches": ["*://*/*"],
        "css": [],
        "js": ["content.js"]
      }
    ]
 }

【问题讨论】:

    标签: google-chrome google-chrome-extension manifest.json


    【解决方案1】:

    progressive web app 与扩展不同;它们在所有可以想象的方面都不同,包括清单。

    这是用于扩展的Manifest File Format。

    此外,Chrome 扩展程序不会像应用程序那样“启动”——它有多个可以在不同时间激活的入口点,例如单击浏览器操作以打开弹出窗口或上下文菜单项,或在某些页面上运行的内容脚本,或为响应某些条件而打开选项卡的背景页面。

    【讨论】:

    • 谢谢!我想我是在混淆清单文件
    猜你喜欢
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 2018-03-09
    • 2019-09-26
    • 1970-01-01
    • 2015-09-21
    相关资源
    最近更新 更多