DesktopHTMLViewer

Using the Xojo Documentations for DesktopHTMLViewer.
https://documentation.xojo.com/api/user_interface/desktop/desktophtmlviewer.html#methods

At bottom of documentation,


If a new browser window is supposed to open, you need to insert some code to handle this event. For example, the user clicks a link that is supposed to display the new page in another window. Use the NewWindow event handler to create the window. The following code assumes that the browser is contained in a window called MainWindow.

Var w As New MainWindow
Title = “New Window” //Title property of new window
w.Show
Return w.HTML


I have the above codes in the HTMLViewer1.NewWindow and this will open up entire new Application MainWindow Screen 2 <main app window 2> which becomes ‘duplicated’ of Application MainWindow Screen 1 <main app window 1> and so now the user is confused as for which Application Window Screen to use?

Screen 1 <main app window 1 with first HTMLViewer1 webpage>
or
Screen 2 <main app window 2 with second HTMLViewer1 web page>

And note: all of the library components is duplicated in both <main app window 1> and <main app window 2>.

Question:
If we can use TabPanel on MainWindow <main app window 1> has HTMLViewer1 in Tab0 and HTMLViewer2 in Tab1, and we are using only one Application Screen.

How can I instruct the Action of ‘new HTML webpage’ to be loaded at Tab1 HTMLViewer2 as a result of website’s open up ‘new html browser window’?

Thanks for your replies, tips, and feedback.

Hi Bob,

First, it looks like there’s a mistake in the code example. It should return the HTMLViewer from the window. I’ll get that fixed. As for the user confusion, it really depends on the app you’re building and the user’s expectations. This event is provided so that if the user right-clicks on a link and asks that the link be opened in a new window, you have way to do that or block them from doing that.