I've a Web site with hundreds of html pages that are already deployed. Now I want to add event listeners to body such as onload and onunload in all the html pages. I don't want to manually change each of every of them, so I'm thinking whether I could dynamically add these listeners. My idea is to write javascript code that finds the DOM node of body and add the listeners to this node. Would it be possible? (it doesn't have to be a cross-browser solution. the code is going to run on Firefox.)
Thanks! Paul