Load Html Code source into HtmlViewer

Hey evryone
How i can load html source code into htmlviewer ?
i do htmlViewer.loadpage(“CodeSource”) but dosent work :frowning:

You need to pass a folderItem. See http://documentation.xojo.com/index.php/HTMLViewer.LoadPage

Thanks for your help ^^

i cant load it just with html code source ?

Nope. Eventually you can use http://documentation.xojo.com/index.php/GetTemporaryFolderItem

Here is a demo Demo

See http://documentation.xojo.com/index.php/HTMLViewer.LoadPage . Pass Nil in the Folderitem.

MBS Plugin has methods to load html into htmlviewer.
Mac? Win? Linux?

Christian, which method in MBS would do this?

What I really want to do is load the html file into a column in a table, and then look up the record and load it into a string and then show it in the htmlviewer. I am using web.

I don’t have a problem with putting the .css, .js, and image files on the server drive but would like to not have to have the .html file itself saved on the server.

I think I can make it load from an .html file, but I really want to grab the html from a record in my database.

Thanks for any help,
Alan

We have several methods depending on the platform.

Platform is Windows. I know how to load the htmlviewer from a file on disk, but need to load it from a record in a table, so if someone knows how to load it from a string, I can probably make that work. It can be either with MBS or without. I own it, so MBS would be fine, I just need to get it to work.
Thanks

here you go:

[code]if TargetWin32 then

if HTMLViewer1.Renderer = 0 then
	// using IE
	
	// IE needs to first load about:blank for this to work
	if HTMLViewer1.IELoadHTMLMBS(TextArea1.Text) then
		// ok
	else
		MsgBox "Failed to load html."
	end if
else
	
	// using WebKit
	dim b as ChromiumBrowserMBS = HTMLViewer1.ChromiumBrowserMBS
	b.MainFrame.LoadString TextArea1.Text, ""
	
end if

elseif TargetLinux then

dim l as LinuxWebViewMBS = HTMLViewer1.LinuxWebViewMBS

l.MainFrame.LoadString TextArea1.Text, "text/html", "utf-8", ""

elseif TargetMacOS then

HTMLViewer1.LoadHTMLStringMBS TextArea1.Text, "text/html", "utf-8", ""

else
Break
end if[/code]

Thanks, I’ll try this out over the weekend.

I am doing web… I get an error that Htmlviewer1 doesn’t have a member named Renderer.

I should have been clearer, I am using Windows but doing Web.

Alan, I am sorry, but that is what you get from hijacking an older thread instead of posting your own in the Web channel. Next time, ask your own question.

See http://documentation.xojo.com/index.php/WebHTMLViewer.LoadPage

Sorry, I didn’t mean to hijack the question, but thought my question was just an extension of the existing one. I also didn’t realize it was in the general section.

For WebHTMLViewer simply use the LoadPage method:

http://documentation.xojo.com/index.php/WebHTMLViewer.LoadPage