我正在尝试在使用Kango 框架完成页面加载时执行一个操作。它适用于 Google Chrome,但不适用于 Mozilla Firefox:
扩展信息.json:
{
"content_scripts": ["content_script.js"],
"description": "Extension description",
"creator": "Kango",
"background_scripts": [
"main.js"
],
"homepage_url": "http://kangoextensions.com/",
"version": "0.9.0",
"browser_button": {
"caption": "Kango",
"icon": "icons/button.png",
"tooltipText": "Kango"
},
"name": "MyExtension"
}
content_script.js:
// ==UserScript==
// @name MyExtension
// @include http://*
// @include https://*
// ==/UserScript==
主.js:
function MyExtension() {
var self = this;
kango.ui.browserButton.addEventListener(kango.ui.browserButton.event.COMMAND, function() {
self._onCommandClick();
});
kango.browser.addEventListener(kango.browser.event.DOCUMENT_COMPLETE, function(event) {
alert('On document complete!');
kango.console.log(event);
});
}
MyExtension.prototype = {
_onCommandClick: function() {
kango.browser.tabs.create({url: 'http://www.stackoverflow.com'});
}
};
var extension = new MyExtension();
谁能解释为什么它在 Mozilla Firefox 中不起作用,但在 Google Chrome 中起作用?
我尝试过其他事件,例如“TAB_CHANGED”和“BEFORE_NAVIGATE”,但它们在 Mozilla Firefox 中也不起作用。
谢谢!:)
[]的