当用户按下浏览器工具栏上的插件按钮时,我想显示其中包含 HTML 内容的下拉菜单。
看来我需要使用panel正如文档中所建议的,但问题是我的内容是动态的,并且在插件工作时可能会随着时间的推移而变化。 AFAIK panel
只能使用预定义的 HTML 文件,并通过 contentScript
属性提供的脚本更改其内容,但即使如此,文档中也明确指出它可能会导致未经批准的插件:
Warning: Unless your content script is extremely simple and consists only of a static string, don't use contentScript: if you do, you may have problems getting your add-on approved on AMO.
Instead, keep the script in a separate file and load it using contentScriptFile. This makes your code easier to maintain, secure, debug and review.
那我能做什么?
最佳答案
您引用的段落是指定义与 contentScript
参数内联的复杂脚本。如果您使用 contentScriptFile
加载脚本,然后修改 HTML,应该没问题。
关于javascript - 如何显示其中包含动态内容 (HTML) 的面板,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/34744194/