overlay.xul
を上書きするファイルがありますbrowser.xul
。Chrome拡張機能で実装されているのと同様の方法でメッセージパッシングを実装したいと思います。
chrome.manifest-
content helloworld content/
overlay chrome://browser/content/browser.xul chrome://helloworld/content/overlay.xul
overlay chrome://navigator/content/navigator.xul chrome://helloworld/content/overlay.xul
skin helloworld classic/1.0 skin/
style chrome://global/content/customizeToolbar.xul chrome://helloworld/content/overlay.css
content_script.js
私の場合はどれを登録するのoverlay.js
ですか?
Overlay.xul-
<script type="application/x-javascript" src="chrome://helloworld/content/jquery.js" />
<script type="application/x-javascript" src="chrome://helloworld/content/overlay.js" />
<script type="application/x-javascript" src="chrome://helloworld/content/background.js" />
今overlay.js
私が使用している私の中で-
document.documentElement.addEventListener('click', function(e) {
messageManager.sendAsyncMessage('MyMessenger.MyMessage', {});
}, true);
そして、それはbackground.js
-
addMessageListener("MyMessenger.MyMessage", function(obj) {
Firebug.Console.log(obj.name);
}, true);
- メッセージパッシングの正しい構文は何ですか?
- コンテンツスクリプトとブラウザスクリプト間の接続を構成するにはどうすればよいですか?