Jump to content

Adding 'unload' Event Handler


csenthilkumar87

Recommended Posts

I am developing a Firefox extension. My problem is not Firefox-specific.I detect page load and create an object that holds some information. After the user closes the tab, or navigates to another URL in the same tab, I no longer need that object, as I will be creating a new one for the newly loaded page.The problem is, I have to set that object to null, when that page unloads. But I am not able to detect 'unload' event.

function setEvtListener(){  // Here I can access the document using window.content.document  // But the following line does not work -  // (doSomething is a well known function)  window.content.document.body.addEventListener('unload', doSomething, false);  // Neither does this..  // window.content.document.getElementsByTagName('body')[0].addEvent.....}

Can someone help me?Thanks

Link to comment
Share on other sites

Archived

This topic is now archived and is closed to further replies.

×
×
  • Create New...