Warning: file_get_contents(/data/phpspider/zhask/data//catemap/2/linux/26.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
Firefox addon 雷鸟67分机不';t在主选项卡中插入内容脚本_Firefox Addon_Firefox Addon Webextensions_Thunderbird_Thunderbird Addon - Fatal编程技术网

Firefox addon 雷鸟67分机不';t在主选项卡中插入内容脚本

Firefox addon 雷鸟67分机不';t在主选项卡中插入内容脚本,firefox-addon,firefox-addon-webextensions,thunderbird,thunderbird-addon,Firefox Addon,Firefox Addon Webextensions,Thunderbird,Thunderbird Addon,我正在通过WebExtensionAPI(带有弹出窗口)进行Thunderbird扩展,我在运行内容脚本以直接从Thunderbird界面获取某些元素(例如当前邮件的附件列表)时遇到了一些困难 我制作了一个popup.html、一个popup.js和一个contentScript.js,当弹出窗口打开时运行。显然,contentScript.js没有在Thunderbird主选项卡中运行,但在我通过代码打开一个新选项卡(带有url)时运行平稳 $(document).ready(functio

我正在通过WebExtensionAPI(带有弹出窗口)进行Thunderbird扩展,我在运行内容脚本以直接从Thunderbird界面获取某些元素(例如当前邮件的附件列表)时遇到了一些困难

我制作了一个popup.html、一个popup.js和一个contentScript.js,当弹出窗口打开时运行。显然,contentScript.js没有在Thunderbird主选项卡中运行,但在我通过代码打开一个新选项卡(带有url)时运行平稳


$(document).ready(function(){

 console.log('Try to execute contentScript'); 

 //  -- create new tab -- 
 //    browser.tabs.create({
 //     url: 'https://example.org'
 //   });

 // -- execute script in current tab --
    browser.tabs.executeScript({

      file: 'scripts/contentScript.js'
    });

});
在控制台中,我期望“contentScript.js-Injected”,但这只在我不在主Thunderbird选项卡中时出现。 当我在主选项卡中时,它只显示“尝试执行contentScript”,然后什么都不出现,没有错误

Thunderbird扩展现在正在从旧的遗留方法(xul文件的覆盖)演变为大多数浏览器使用的实际WebExtension Api,但有一些区别:在Firefox中,扩展工作没有任何问题,因此我认为Thunderbird的主选项卡在某种程度上受到了保护,不受内容注入的影响


我的目标是直接从界面获取附件列表和其他元素,但显然我不能。

您可能可以在
后台使用事件侦听器获取附件-请参阅以获取指向文档和示例的链接。

// from contentScript.js

console.log('contentScript.js - Injected');