The standard HTML template in HelpNDoc has undergone significant optimizations for enhanced speed in downloading and navigating. This optimization means that when a user selects a topic from the table of contents, HelpNDoc only refreshes the topic's content instead of reloading the entire page. As a result, certain elements like page-specific JavaScript code may not execute when a page is accessed via the table of contents. To address this, HelpNDoc provides a specific event, app.EVENTS.onTopicChanged, to track changes in topics.
The usage of this event is as follows:

app.EVENTS.onTopicChanged = (sUrl) => { /* Custom code run when a new topic is loaded */ }


There are multiple ways to listen to this event: