Simple Web Browser Q's

Hi, I’m new to Xojo, and these forums, so please let me know if there’s anything I can do to improve my posts.

I have two questions regarding Xojo, both having to do with making a simple web browser.

  1. Can I have the user add tabs to a tabPanel? I would like to create a browser where the user can add (or close tabs). Is this possible? How would I go about doing it? (Right now I only have the set amount of tabs that I setup via the Panels attribute in the inspector.)

  2. How can I switch the default search engine for the HTML viewer? If you run HTMLViewer.LoadURL("hello world") it goes to Bing and searches “hello world”. How would I make it go to Google instead of Bing?


  1. The Append, Insert and Remove methods on TabPanel will let you add or remove tabs.

  2. I’m not aware of an invalid URL going to Bing. Perhaps that is a Windows-specific thing or something your ISP is doing? Anyway, you can send a parameter to Google using a URL like this:

This is the default behavior for Windows.

To change that in Windows 10 Edge, click on the ellipse at the right of the toolbar (…) and click settings, then View Advanced settings. Go down the list and click on the “search in the address bar with” comboBox.

However, you can send yourself the query to Google. Here is an example in the KeyDown event of a TextField called searchBar, which sends to the HTMLViewer when the user presses Return :

[code]Function KeyDown(Key As String) As Boolean // Don’t copy that
if key = chr(13) then
dim theSearch as String

if instr(SearchBar.text, "http://") = 0 then
  theSearch = ""+EncodeURLComponent(searchBar.Text)
  theSearch = searchBar.Text
end if


return true

end if

End Function // Don’t copy that

Verify the URL in code before calling LoadURL. If it’s not valid, build a Google search URL based off of it and direct the viewer there.

Alright. Thanks everyone!