开发者

firefox extension: tab's body is loaded

开发者 https://www.devze.com 2023-03-07 20:07 出处:网络
How can bind onload event on \"body\" element of second tab in Firefox extension? I can\'t use wi开发者_Go百科ndow.onload \'cause it binds on current tab.

How can bind onload event on "body" element of second tab in Firefox extension? I can't use wi开发者_Go百科ndow.onload 'cause it binds on current tab. So how can I do that?


Ok, I didn't read the part about opening a new tab. We're doing it with this code in the SendToPhone extension:

var tab = gBrowser.addTab(url);
var c2pTab = gBrowser.getBrowserForTab(tab);
//Add listener 
c2pTab.addEventListener("load", function () {
    // do your stuf
}, true);

For reference, the initial answer proposed a generic "detect page load": https://developer.mozilla.org/en/Code_snippets/On_page_load

0

精彩评论

暂无评论...
验证码 换一张
取 消