WebHTMLViewer LoadURL and LoadHTML

With Web Framework 2.0, if you first use LoadURL you then cannot use LoadHTML (or vice versa). For example, this works fine:


but then the function below will do nothing:


However, if you do this same LoadHTML call first it displays Hello. If you then call the LoadURL as shown above, it now displays that website plus the word Hello above it.

I have also discovered if you put a url into the HTMLViewer1.URL property at design time, the LoadHTML function will not work at all even if you LoadURL("") at runtime.

Using Web Framework 2.0, I’m trying to find a way to switch between different content in the WebHTMLViewer control (sometimes I want a URL to an actual web page and sometimes a string of actual HTML tags).

I think switching between LoadURL and LoadHTML continues to work fine with Web Framework 1.0.

To replicate the web 1 behavior, use a WebFile and LoadUrl. LoadHTML now simply writes HTML onto the page.

My understanding is WebFile allows a local file stored on the server to be presented within the WebHTMLViewer control. However, I want to display an external web page in the WebHTMLViewer control. Are you saying I should first download the external web page, store it in a local file, then use WebFile to get a URL that I can display in WebHTMLViewer with LoadURL?

As I think more about this, this approach won’t work. If the external page contains relative links to other pages, those links would all be broken if you download and store that page in a local file on the server.

Is it really possible for a WebHTMLViewer control to flip back and forth between displaying an external web page and a string of HTML text?

I see the solution is to not use LoadHTML. Instead save the HTML source to a local file on the server, then use WebFile to load it into WebHTMLViewer with LoadURL. Now I can toggle between displaying external website pages and locally generated HTML code.


In the example you give, this should not work:


“Hello” is not HTML.

A basic form of what should work is:


Yes, my initial example was a bit sloppy. Even with proper HTML tags, the core problem still remains. The only work-around I have found is to not use LoadHTML as explained in my last entry above.

I have no idea how these commands were implemented.

In principle, both should work.