What happens inside the HTMLViewer is under control of Webkit (or the rendering engine), meaning that you should control, detect, Etc. with the javascript, html, Etc. contained inside the webpage code. Am not sure that the NewWindow event fires when you click on a link, because of that.
Anyway, if you want to intercept via the Xojo program, you could detect the DocumentBegin() event. It returns the URL it is navigating to. If the URL is not allowed or you want to redirect, use the Cancel method, and redirect with LoadURL.
OK, I goofed. I had the cursor changing to a pointer over a certain part of the page, but that certain part wasn’t necessarily a link, so clicking on it didn’t trigger like a link-click should. Now that I’m clicking in the right place, I’m getting responses in both NewWindow and DocumentStart.
NewWindow fires only if I right click on a link and specify open in a new window, or if the link opens with “_blank”.
DocumentBegin fires everytime you navigate to other page within the same window. Strangely it fired repeatedly on youtube. Perhaps it has some reloading with ajax or so.
[quote=220617:@Julio Debroy]I did a small test app (OSX).
NewWindow fires only if I right click on a link and specify open in a new window, or if the link opens with “_blank”.
DocumentBegin fires everytime you navigate to other page within the same window. Strangely it fired repeatedly on youtube. Perhaps it has some reloading with ajax or so.
I don’t see an event named DocumentStart…[/quote]
Thanks, @Julio Debroy . I will add “_blank” to all my links and see what happens.
DocumentStart is an alias for DocumentBegin… in my own mind. (haha… Just a typo. Oopsies.)