【问题标题】:What should be the valid 'matches' pattern in 'external_connectable' in manifest.json of chrome extension?chrome 扩展的 manifest.json 中的“external_connectable”中的有效“匹配”模式应该是什么?
【发布时间】:2014-02-21 06:05:20
【问题描述】:

从链接: http://developer.chrome.com/extensions/manifest/externally_connectable

我想知道我的有效匹配模式应该是什么。

“参考”块内部几乎没有混淆:

模式不能包含通配符域或(有效)顶级域的子域; *://google.com/*http://*.chromium.org/* 有效,而 <all_urls>http://*/**://*.com/* 甚至 http://*.appspot.com/* 都无效。

在上面一行中

http://*.chromium.org/*

http://*.appspot.com/*

那么为什么第一个有效而第二个无效呢?

编辑:当我提供 '*://*.mywebsite.com' 时,它反映为无效清单,但是给出了与 external_connectable 的示例代码相同的模式,意味着应该是有效的有效模式,但实际上验证失败。

【问题讨论】:

    标签: regex google-chrome google-chrome-extension google-chrome-devtools


    【解决方案1】:

    “appspot.com”是public suffix list 中列出的有效顶级域。这意味着“appspot.com”被视为 TLD,类似于“.co.uk”或“.com”。

    此外,the documentation 中的代码示例中有一个小错误,"https://*.google.com" 应该是"https://*.google.com/""https://*.google.com/*"。有效的match pattern 需要用斜杠表示路径,禁止省略。

    【讨论】:

    猜你喜欢
    • 2015-01-10
    • 1970-01-01
    • 2021-12-24
    • 2020-03-04
    • 2016-06-26
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    相关资源
    最近更新 更多