English 中文(简体)
从火ox延伸的装货箱中通过物体
原标题:Passing object from loaded script in firefox extension

我正在开发一个能够从现有表格的网页上检索数据的火fox延伸系统。 在用户点击超延工具栏,进行一些处理并从网页获取信息时,我正在把一个文字上装入网页。 我希望在人口窗口中显示这一信息。

我正在使用以下复印件来装载文字:

var loader = Components.classes[ "@mozilla.org/moz/jssubscript-loader;1" ].getService( Components.interfaces.mozIJSSubScriptLoader );
loader.loadSubScript("chrome://dynamonote/content/contentscript.js");

我需要寄送内容稿.js中制造的物体,并用波段显示。

在我执行该法典时,我没有确定行凶者的身份错误。 我使用的守则细节如下:

In the onCommand of the overlay, I am calling the following function:

var Popup = {
    showPopup: function() {
        window.open("chrome://dynamonote/content/popup.html", "dynamonote", "chrome");
    }
};

这表明了一个人口窗口。 在登峰造物的内在功能中,当页负荷时,我执行以下法规:

        function loadContentScript() {
            Components.utils.reportError("loadContentScript() called");
            gBrowser.selectedBrowser.messageManager.loadFrameScript("chrome://dynamonote/content/contentscript.js", true);
            gBrowser.selectedBrowser.messageManager.addMessageListener("foomessage", onMessage);
            Components.utils.reportError("loadContentScript() executed");
        }

以下法典在内容稿中执行:

(function() {
    Components.utils.reportError("-- content script -- ");
    var doc = content.document;

    //Do something here

    var data = {
        "time": new Date().toLocaleString()
    };
    Components.utils.reportError("-- content script -- found something");
        sendSyncMessage("foomessage", onMessage(data));
})();

请帮助我这样做。

最佳回答
问题回答

暂无回答




相关问题
selected text in iframe

How to get a selected text inside a iframe. I my page i m having a iframe which is editable true. So how can i get the selected text in that iframe.

How to fire event handlers on the link using javascript

I would like to click a link in my page using javascript. I would like to Fire event handlers on the link without navigating. How can this be done? This has to work both in firefox and Internet ...

How to Add script codes before the </body> tag ASP.NET

Heres the problem, In Masterpage, the google analytics code were pasted before the end of body tag. In ASPX page, I need to generate a script (google addItem tracker) using codebehind ClientScript ...

Clipboard access using Javascript - sans Flash?

Is there a reliable way to access the client machine s clipboard using Javascript? I continue to run into permissions issues when attempting to do this. How does Google Docs do this? Do they use ...

javascript debugging question

I have a large javascript which I didn t write but I need to use it and I m slowely going trough it trying to figure out what does it do and how, I m using alert to print out what it does but now I ...

Parsing date like twitter

I ve made a little forum and I want parse the date on newest posts like twitter, you know "posted 40 minutes ago ","posted 1 hour ago"... What s the best way ? Thanx.