I'm not sure but not being able to collapse index tree might be due the fact that by default pages that are being displayed in TWebBrowser component or whenever any third part program is using IWebBrowser interface are being opened in backward compatibility mode. In order to avoid that your program must be registered as a Web Browser. See the link bellow for more information
https://stackoverflow.com/a/25843958
Any way with the help of your posted code I can now display and navigate Platform eXtended documentation properly as it consists of just bunch of self contained HTML files (no use of frames). So I don't even need the code in OnNewWindow3 event.
Bookmarks