Firefox扩展不适用于http://https://以外的URL
Firefox extension not working with URLs other than http:// https://
我安装了两个Firefox扩展程序,当我双击它们时可以翻译单词:Google Translator and Wictionary和Google translate。
两者都为您提供了只需双击即可翻译单词的可能性。但不同的是,Wictionary和谷歌翻译只适用于我双击的任何地方。它适用于本地文件(file:///...),EPUBReader扩展,它在Firefox中打开EPUB文件,URL类似于(about:EPUBReader?id=5)等。由于我更喜欢谷歌翻译,我想像使用Wictionary和谷歌翻译一样使用它,但它不适用于http://https://以外的任何URL。
我试着比较他们的源代码,并在谷歌翻译中搜索了好几次来找到和编辑这个功能,但什么都做不了。
帮助任何人??感谢
谷歌翻译的一些目录
- 资源:
- igtranslator:
- lib:
- firefox.js
- common.js
- config.js
- 数据:
- (许多png、html、css)
- inject.js
- options.js
- popup.js
- lib:
- igtranslator:
- bootstrap.js
以下是firefox.js中负责监听URL协议的代码片段:
var workers = [], content_script_arr = [];
pageMod.PageMod({ /* page */
include: ["*"],
contentScriptFile: [data.url("content_script/inject.js")],
contentScriptWhen: "start",
contentStyleFile : data.url("content_script/inject.css"),
onAttach: function(worker) {
array.add(workers, worker);
worker.on('pageshow', function() { array.add(workers, this); });
worker.on('pagehide', function() { array.remove(workers, this); });
worker.on('detach', function() { array.remove(workers, this); });
content_script_arr.forEach(function (arr) {
worker.port.on(arr[0], arr[1]);
});
}
});
将include:
行更改为
include: ["*","file://*"],
将对本地文件执行此操作。
相关文章:
- 调用 http url 有效,但 Https 不起作用
- 在不使用任何http、https或ftp的情况下验证URL
- Firefox扩展不适用于http://https://以外的URL
- 使用JS获取网站URL不适用于https
- 正则表达式以确保 HTTPS URL 架构
- Casperjs 无法打开 HTTPS URL
- http 使浏览器请求对应的 https URL 对于 http URL,而无需编辑所有页面并手动将所有 URL 更改为
- 使用AngularJS使用HTTPS url跨域加载JSON
- 如何根据浏览器url将url嵌入angularjs中作为https
- 正在加载可能重定向到HTTP的HTTPS图像url
- URI Regex:如果URL有效,则用空字符串替换http://、https://、ftp://
- Angularjs -在HTTPS URL上使用$http
- 验证URL(如果用户使用http:// https:// www)
- 为什么CDN's在URL前面有2 //而不是http或https ?
- 我如何使一个javascript文件到一个有效的https url
- Jquery和post方法安全性与HTTPS url
- 返回带HTTP URL的showmodaldialog到HTTPS页面的值
- 如何根据当前URL指定HTTP或HTTPS
- 在https:// Page中调用http:// url
- Iframe与HTTPS视频url不工作