Platforms to show: All Mac Windows Linux Cross-Platform

Back to IEDocumentMBS class.

IEDocumentMBS.CallFunction(FunctionName as string, paramArray params as variant) as variant

Type Topic Plugin Version macOS Windows Linux iOS Targets
method HTMLViewer Win MBS Win Plugin 20.0 ❌ No ✅ Yes ❌ No ❌ No Desktop only
Calls a JavaScript function.
Example
dim doc as IEDocumentMBS = htmlviewer1.IEDocumentMBS

dim v as variant = doc.CallFunctiom("test", 2, 3)

Returns result as variant.
You can pass as many parameters as needed.

Our plugin converts Xojo data types to JavaScript data types like boolean, number, text or NULL. This could be extended in future to convert arrays, too.

FunctionName should be the name of a global function defined in JavaScript.

See also:

IEDocumentMBS.CallFunction(FunctionName as string, params() as variant) as variant

Type Topic Plugin Version macOS Windows Linux iOS Targets
method HTMLViewer Win MBS Win Plugin 20.0 ❌ No ✅ Yes ❌ No ❌ No Desktop only
Calls a JavaScript function.
Example
dim doc as IEDocumentMBS = htmlviewer1.IEDocumentMBS

dim Params() as Variant
Params.append 2
Params.append 3

dim v as variant = doc.CallFunctiom("test", Params)

Returns result as variant.
You can pass parameters for the function as array.

Our plugin converts Xojo data types to JavaScript data types like boolean, number, text or NULL. This could be extended in future to convert arrays, too.

FunctionName should be the name of a global function defined in JavaScript.

See also:

IEDocumentMBS.Constructor(DesktopHTMLViewer as DesktopHTMLViewer)

Type Topic Plugin Version macOS Windows Linux iOS Targets
method HTMLViewer Win MBS Win Plugin 22.0 ❌ No ✅ Yes ❌ No ❌ No Desktop only
Creates new web document object for this HTMLViewer.

For browser based on Internet Explorer on Windows.
Raises exception on failure.

See also:

IEDocumentMBS.Constructor(HTMLViewer as HTMLViewer)

Type Topic Plugin Version macOS Windows Linux iOS Targets
method HTMLViewer Win MBS Win Plugin 20.0 ❌ No ✅ Yes ❌ No ❌ No Desktop only
Creates new web document object for this HTMLViewer.

For browser based on Internet Explorer on Windows.
Raises exception on failure.

See also:

IEDocumentMBS.ContinueFindText(text as string, count as integer, flags as integer, selectText as boolean) as boolean

Type Topic Plugin Version macOS Windows Linux iOS Targets
method HTMLViewer Win MBS Win Plugin 20.0 ❌ No ✅ Yes ❌ No ❌ No Desktop only
Continues a search started with IEFindTextMBS.
Example
dim d as IEDocumentMBS = HTMLViewer1.IEDocumentMBS

// find first
dim found as boolean = d.FindText("Xojo", 0, 0, true)

msgbox "Found Xojo: "+str(found)

if found then
// find next
found = d.ContinueFindText("Xojo", 0, 0, true)
end if

Parameters are the same as for IEFindTextMBS.

IEDocumentMBS.DrawToHDC(HDC as Ptr, PrinterName as string = "")

Type Topic Plugin Version macOS Windows Linux iOS Targets
method HTMLViewer Win MBS Win Plugin 20.0 ❌ No ✅ Yes ❌ No ❌ No Desktop only
Draws the content of the html document into the graphics context.

As of Windows Internet Explorer 9, this method is deprecated and should not be used.
Returns true on success and false on failure.

With some printers, running DrawToDC may cause problems. You can ensure that DrawToDC works properly on all printers by running SetDocumentPrinter method first, and then passing the modified device context to DrawToDC. The plugin calls SetDocumentPrinter for you when you provide a printer name.

IEDocumentMBS.Evaluate(expression as string) as variant

Type Topic Plugin Version macOS Windows Linux iOS Targets
method HTMLViewer Win MBS Win Plugin 20.0 ❌ No ✅ Yes ❌ No ❌ No Desktop only
Evaluates a JavaScript expression.
Example
dim doc as IEDocumentMBS = htmlviewer1.IEDocumentMBS

dim v as variant = doc.Evaluate("1+2")
Msgbox v

In contrast to IEWindowMBS.RunJavaScript this function returns the result on Windows, but needs IE 9 or newer.

Our plugin converts Xojo data types to JavaScript data types like boolean, number, text or NULL. This could be extended in future to convert arrays, too.

IEDocumentMBS.FindText(text as string, count as integer, flags as integer, selectText as boolean) as boolean

Type Topic Plugin Version macOS Windows Linux iOS Targets
method HTMLViewer Win MBS Win Plugin 20.0 ❌ No ✅ Yes ❌ No ❌ No Desktop only
Finds text on the current website.
Example
dim d as IEDocumentMBS = HTMLViewer1.IEDocumentMBS

// find first
dim found as boolean = d.FindText("Xojo", 0, 0, true)

msgbox "Found Xojo: "+str(found)

if found then
// find next
found = d.ContinueFindText("Xojo", 0, 0, true)
end if

text: the string that specifies the text to find.
count: long that specifies the number of characters to search from the starting point of the range. A positive integer indicates a forward search; a negative integer indicates a backward search.
Flags: integer that specifies one or more of the following flags to indicate the type of search:

0Default. Match partial words.
1Match backwards.
2Match whole words only.
4Match case.
131072Match bytes.
536870912Match diacritical marks.
1073741824Match Kashida character.
2147483648Match AlefHamza character.

Returns true: The search text was found.
Returns false: The search text was not found.

IEDocumentMBS.Frames as IEWindowMBS()

Type Topic Plugin Version macOS Windows Linux iOS Targets
method HTMLViewer Win MBS Win Plugin 21.0 ❌ No ✅ Yes ❌ No ❌ No Desktop only
Queries the collection of frames.
Example
Dim hdoc As IEDocumentMBS = HTMLViewer1.IEDocumentMBS
Dim frames() As IEWindowMBS = hdoc.Frames

For Each frame As IEWindowMBS In frames
Dim doc As IEDocumentMBS = frame.Document

Dim URL As String = doc.URL
Dim Name As String = doc.NameProp
Dim HTMLText As String = doc.HTMLText

Break // read in debugger
Next

MBS Plugin will return the window objects for each frame as an array.

IEDocumentMBS.GetTextArea(FormName as String, FieldName as String) as String

Type Topic Plugin Version macOS Windows Linux iOS Targets
method HTMLViewer Win MBS Win Plugin 20.0 ❌ No ✅ Yes ❌ No ❌ No Desktop only
Queries text for a textarea.

FormName can be "" to look for any field with given name.
Raises exception if field is not found.
Returns text from textarea.

IEDocumentMBS.HTMLText as string

Type Topic Plugin Version macOS Windows Linux iOS Targets
method HTMLViewer Win MBS Win Plugin 20.0 ❌ No ✅ Yes ❌ No ❌ No Desktop only
Returns a copy of the html source code of the current webpage.
Example
dim d as IEDocumentMBS = HTMLViewer1.IEDocumentMBS
dim htmlText as string = d.HTMLText
dim PlainText as string = d.text
dim toString as string = d.ToString

Break // see in debug

Improved in plugin version 12.2 to return better HTML text. This is the html generated from current web content and not the page we originally loaded. So this works with Editable property.
Returns "" on any error.

IEDocumentMBS.Image as picture

Type Topic Plugin Version macOS Windows Linux iOS Targets
method HTMLViewer Win MBS Win Plugin 20.0 ❌ No ✅ Yes ❌ No ❌ No Desktop only
Copies the picture from the document.
Example
dim d as IEDocumentMBS = HTMLViewer1.IEDocumentMBS
dim p as Picture = d.Image
canvas1.Backdrop = p

You may want to resize the htmlviewer to get a picture without scrollbars. (See example projects)
You may need to call ClearFocus as it seems like if the focus is on the htmlviewer it does not draw itself in our picture.

IEDocumentMBS.LoadHTML(HTMLText as string)

Type Topic Plugin Version macOS Windows Linux iOS Targets
method HTMLViewer Win MBS Win Plugin 20.0 ❌ No ✅ Yes ❌ No ❌ No Desktop only
Loads the HTML text into the htmlviewer.
Example
dim d as IEDocumentMBS = HTMLViewer1.IEDocumentMBS

d.LoadHTML "<p>Hello World</p>"

Does not use a temp file like Xojo's built in method.
Returns true on success.
On Windows you may need to reset webviewer before or load "about:blank" to initialize the webviewer by Xojo (or Xojo).

IEDocumentMBS.PrintPreview as boolean

Type Topic Plugin Version macOS Windows Linux iOS Targets
method HTMLViewer Win MBS Win Plugin 20.0 ❌ No ✅ Yes ❌ No ❌ No Desktop only
Commands Internet Explorer to show the print preview dialog for this htmlviewer.

Returns true on success. Returns false if function is not supported.
The function returns directly while the preview dialog is still running.

IEDocumentMBS.Reload(Force as boolean = false)

Type Topic Plugin Version macOS Windows Linux iOS Targets
method HTMLViewer Win MBS Win Plugin 20.0 ❌ No ✅ Yes ❌ No ❌ No Desktop only
Reloads the current page.
Example
dim d as IEDocumentMBS = HTMLViewer1.IEDocumentMBS
d.Reload

Boolean that specifies one of the following possible values:
False: Default. Reloads the document from the cache.
True: Reloads the document from the server.

IEDocumentMBS.SetTextArea(FormName as String, FieldName as String, Value as String) as Boolean

Type Topic Plugin Version macOS Windows Linux iOS Targets
method HTMLViewer Win MBS Win Plugin 20.0 ❌ No ✅ Yes ❌ No ❌ No Desktop only
Sets text for a textarea.

FormName can be "" to look for any field with given name.
Raises exception if field is not found.
Returns true if text is set or false on failure.

IEDocumentMBS.Text as string

Type Topic Plugin Version macOS Windows Linux iOS Targets
method HTMLViewer Win MBS Win Plugin 20.0 ❌ No ✅ Yes ❌ No ❌ No Desktop only
Returns a copy of the text of the current webpage.
Example
dim d as IEDocumentMBS = HTMLViewer1.IEDocumentMBS
dim htmlText as string = d.HTMLText
dim PlainText as string = d.text
dim toString as string = d.ToString

Break // see in debug

Asks Internet Explorer for a selection of the whole document and asks selection about the text content.
Returns "" on any error.

The items on this page are in the following plugins: MBS Win Plugin.


The biggest plugin in space...