Added event handler onReload to make it possible to do cleanup before a page is reloaded.