firefox extension: tab's body is loaded
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
精彩评论