Reputation: 2799
How can bind onload event on "body" element of second tab in Firefox extension? I can't use window.onload 'cause it binds on current tab. So how can I do that?
Upvotes: 0
Views: 181
Reputation: 12690
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
Upvotes: 1