Xojo Developer Conference
25/27th April 2018 in Denver.
MBS Xojo Conference
6/7th September 2018 in Munich, Germany.

Platforms to show: All Mac Windows Linux Cross-Platform

Previous items Next items

WebViewMBS.Constructor(x as Double, y as Double, w as Double, h as Double, FrameName as string, GroupName as string)
Type Topic Plugin Version macOS Windows Linux Console & Web iOS
method HTMLViewer Mac MBS MacControls Plugin 7.7 Yes No No Yes, macOS only No
Function: Initializes a webview with a frame rectangle, a WebFrame name, and a group name.
Example:
dim w as webviewmbs

w=new WebViewMBS(0,0,800,600,"test","test")

w.LoadHTMLString "Hello World",""

// and later

dim n as NSImageMBS = w.RenderImage
Backdrop=n.CopyPicture
Notes:
The frameName should not be one of the pre-defined frame names (see the WebFrame findFrameNamed for a description of their meaning), but a custom name or a name used in HTML source. The groupName argument is an arbitrary identifier used to group related frames. For example, JavaScript running in a frame can access any other frame in the same group. It's up to the application how it chooses to scope related frames. Both frameName and groupName may be "". This method is the designated initializer for the WebView class.

On success the handle property is not zero.

See also:

Feedback, Comments & Corrections

WebViewMBS.ContinuousSpellCheckingEnabled as boolean
Type Topic Plugin Version macOS Windows Linux Console & Web iOS
property HTMLViewer Mac MBS MacControls Plugin 7.7 Yes No No Yes, macOS only No
Function: Whether continuous spell checking is enabled.
Example:
webview1.ContinuousSpellCheckingEnabled=True
Notes:
True if the object should have continuous spell-checking enabled; otherwise, false.
Available in Mac OS X v10.3.9 and later.
(Read and Write computed property)

Feedback, Comments & Corrections

WebViewMBS.copy
Type Topic Plugin Version macOS Windows Linux Console & Web iOS
method HTMLViewer Mac MBS MacControls Plugin 9.3 Yes No No Yes, macOS only No
Function: Action method that copies the selected content to the general pasteboard.
Notes:
This action method copies the selected content onto the general pasteboard, in as many formats as the receiver supports. For example, a plain text object uses NSStringPboardType for plain text, and a rich text object also uses NSRTFPboardType.

Available in Mac OS X v10.3.9 and later.

Feedback, Comments & Corrections

WebViewMBS.copyFont
Type Topic Plugin Version macOS Windows Linux Console & Web iOS
method HTMLViewer Mac MBS MacControls Plugin 9.3 Yes No No Yes, macOS only No
Function: An action method that copies font information onto the font pasteboard.
Notes:
This action method copies the font information for the first character of the selection (or for the insertion point) onto the font pasteboard as NSFontPboardType.

Available in Mac OS X v10.3.9 and later.

Feedback, Comments & Corrections

WebViewMBS.CustomTextEncodingName as String
Type Topic Plugin Version macOS Windows Linux Console & Web iOS
property HTMLViewer Mac MBS MacControls Plugin 7.2 Yes No No Yes, macOS only No
Function: The custom text encoding name.
Notes:
On getting:
The custom text encoding name or "" if no custom text encoding name has been set.

On setting:
Make the page display with a different text encoding; stops any load in progress.
The text encoding passed in overrides the normal text encoding smarts including what's specified in a web page's header or HTTP response.
The text encoding automatically goes back to the default when the top level frame changes to a new location.
Setting the text encoding name to nil makes the webView use default encoding rules.
(Read and Write computed property)

Feedback, Comments & Corrections

WebViewMBS.CustomUserAgent as String
Type Topic Plugin Version macOS Windows Linux Console & Web iOS
property HTMLViewer Mac MBS MacControls Plugin 7.2 Yes No No Yes, macOS only No
Function: The custom user-agent string or nil if no custom user-agent string has been set.
Example:
webview1.CustomUserAgent="HelloWorldBrowser"
Notes: (Read and Write computed property)

Feedback, Comments & Corrections

WebViewMBS.cut
Type Topic Plugin Version macOS Windows Linux Console & Web iOS
method HTMLViewer Mac MBS MacControls Plugin 9.3 Yes No No Yes, macOS only No
Function: An action method that deletes selected content and puts it on the general pasteboard.
Notes:
This action method deletes the selected content and places it onto the general pasteboard, in as many formats as the receiver supports. For example, a plain text object uses NSStringPboardType for plain text, and a rich text object also uses NSRTFPboardType.

Available in Mac OS X v10.3.9 and later.

Feedback, Comments & Corrections

WebViewMBS.dashboardBehavior(behavior as Integer) as boolean
Type Topic Plugin Version macOS Windows Linux Console & Web iOS
property HTMLViewer Mac MBS MacControls Plugin 7.8 Yes No No Yes, macOS only No
Function: Get or set the htmlviewer behavior.
Notes:
This is a private API from Apple which may break in the future.
It seems to exist for the dashboard application to switch some flags for event handling.

Behavior constants:
const WebDashboardBehaviorAlwaysSendMouseEventsToAllWindows = 0
const WebDashboardBehaviorAlwaysSendActiveNullEventsToPlugIns = 1
const WebDashboardBehaviorAlwaysAcceptsFirstMouse = 2
const WebDashboardBehaviorAllowWheelScrolling = 3
const WebDashboardBehaviorUseBackwardCompatibilityMode = 4
(Read and Write computed property)

Feedback, Comments & Corrections

WebViewMBS.delete
Type Topic Plugin Version macOS Windows Linux Console & Web iOS
method HTMLViewer Mac MBS MacControls Plugin 9.3 Yes No No Yes, macOS only No
Function: An action method that deletes the selected content.
Notes:
The pasteboard is unaffected by invoking this method.

Available in Mac OS X v10.3.9 and later.

Feedback, Comments & Corrections

WebViewMBS.deleteBackward
Type Topic Plugin Version macOS Windows Linux Console & Web iOS
method HTMLViewer Mac MBS MacControls Plugin 12.2 Yes No No Yes, macOS only No
Function: Implemented by WebView to delete the selection, if there is one, or a single element backward from the insertion point (a letter or character in text, for example).

Feedback, Comments & Corrections

WebViewMBS.deleteBackwardByDecomposingPreviousCharacter
Type Topic Plugin Version macOS Windows Linux Console & Web iOS
method HTMLViewer Mac MBS MacControls Plugin 12.2 Yes No No Yes, macOS only No
Function: Implemented by WebView to delete the selection, if there is one, or a single character backward from the insertion point.
Notes: If the previous character is canonically decomposable, this method should try to delete only the last character in the grapheme cluster (for example, deleting "a"+ "'" results in "a"). NSResponder declares but does not implement this method.

Feedback, Comments & Corrections

WebViewMBS.deleteForward
Type Topic Plugin Version macOS Windows Linux Console & Web iOS
method HTMLViewer Mac MBS MacControls Plugin 12.2 Yes No No Yes, macOS only No
Function: Implemented by WebView to delete the selection, if there is one, or a single element forward from the insertion point (a letter or character in text, for example).

Feedback, Comments & Corrections

WebViewMBS.deleteSelection
Type Topic Plugin Version macOS Windows Linux Console & Web iOS
method HTMLViewer Mac MBS MacControls Plugin 12.2 Yes No No Yes, macOS only No
Function: Deletes the receiver's current selection unless it's collapsed.
Notes: No content is removed if the current selection is collapsed (a range is selected with the same nodes and offsets for the start and end) or if there is no current selection.

Feedback, Comments & Corrections

WebViewMBS.deleteToBeginningOfLine
Type Topic Plugin Version macOS Windows Linux Console & Web iOS
method HTMLViewer Mac MBS MacControls Plugin 12.2 Yes No No Yes, macOS only No
Function: Implemented by WebView to delete the selection, if there is one, or all text from the insertion point to the beginning of a line (typically of text).
Notes: Also places the deleted text into the kill buffer.

Feedback, Comments & Corrections

WebViewMBS.deleteToBeginningOfParagraph
Type Topic Plugin Version macOS Windows Linux Console & Web iOS
method HTMLViewer Mac MBS MacControls Plugin 12.2 Yes No No Yes, macOS only No
Function: Implemented by WebView to delete the selection, if there is one, or all text from the insertion point to the beginning of a paragraph of text.
Notes: Also places the deleted text into the kill buffer.

Feedback, Comments & Corrections

WebViewMBS.deleteToEndOfLine
Type Topic Plugin Version macOS Windows Linux Console & Web iOS
method HTMLViewer Mac MBS MacControls Plugin 12.2 Yes No No Yes, macOS only No
Function: Implemented by WebView to delete the selection, if there is one, or all text from the insertion point to the end of a line (typically of text).
Notes: Also places the deleted text into the kill buffer.

Feedback, Comments & Corrections

WebViewMBS.deleteToEndOfParagraph
Type Topic Plugin Version macOS Windows Linux Console & Web iOS
method HTMLViewer Mac MBS MacControls Plugin 12.2 Yes No No Yes, macOS only No
Function: Implemented by WebView to delete the selection, if there is one, or all text from the insertion point to the end of a paragraph of text.
Notes: Also places the deleted text into the kill buffer.

Feedback, Comments & Corrections

WebViewMBS.deleteWordBackward
Type Topic Plugin Version macOS Windows Linux Console & Web iOS
method HTMLViewer Mac MBS MacControls Plugin 12.2 Yes No No Yes, macOS only No
Function: Implemented by WebView to delete the selection, if there is one, or a single word backward from the insertion point.

Feedback, Comments & Corrections

WebViewMBS.deleteWordForward
Type Topic Plugin Version macOS Windows Linux Console & Web iOS
method HTMLViewer Mac MBS MacControls Plugin 12.2 Yes No No Yes, macOS only No
Function: Implemented by WebView to delete the selection, if there is one, or a single word forward from the insertion point.

Feedback, Comments & Corrections

WebViewMBS.DrawsBackground as Boolean
Type Topic Plugin Version macOS Windows Linux Console & Web iOS
property HTMLViewer Mac MBS MacControls Plugin 7.2 Yes No No Yes, macOS only No
Function: Enable or disable the background drawing.
Notes:
Works only with Webkit on Mac OS X 10.3.9 and newer.
Returns false on unsupported Webkit versions.
If you set it to false, the background is not drawn and you can have transparent websites like the Dashboard widgets.
(Read and Write computed property)

Feedback, Comments & Corrections

WebViewMBS.Editable as boolean
Type Topic Plugin Version macOS Windows Linux Console & Web iOS
property HTMLViewer Mac MBS MacControls Plugin 9.4 Yes No No Yes, macOS only No
Function: Whether the user is allowed to edit the document.
Notes:
You can change the receiver's document programmatically regardless of this setting.
Available in Mac OS X v10.3.9 and later.

Normally, an HTML document is not editable unless the elements within the document are editable. This method provides a low-level way to make the contents of a WebView object editable without altering the document or DOM structure.

True if the receiver allows the user to edit the document. False if an element in the receiver's document can be edited only if the CONTENTEDITABLE attribute has been set on the element or one of its parent elements.
(Read and Write computed property)

Feedback, Comments & Corrections

WebViewMBS.EstimatedProgress as Double
Type Topic Plugin Version macOS Windows Linux Console & Web iOS
method HTMLViewer Mac MBS MacControls Plugin 7.2 Yes No No Yes, macOS only No
Function: An estimate of the percent complete for a document load.
Example:
// waits till rendering is done:
dim f as FolderItem = SpecialFolder.Desktop.Child("test.html")

WebView.mainFrame.LoadURL f.URLPath

while WebView.EstimatedProgress>0
DelayMBS 0.1
wend

// this works only because EstimatedProgress is set to 0.1 by LoadURL
// and set back to zero when the load process finishes.
// If future Webkit versions change the EstimatedProgress results,
// it will break.
Notes: This value will range from 0 to 1.0 and, once a load completes, will remain at 1.0 until a new load starts, at which point it will be reset to 0. The value is an estimate based on the total number of bytes expected to be received for a document, including all it's possible subresources. For more accurate progress indication it is recommended that you implement a WebFrameLoadDelegate and a WebResourceLoadDelegate.

Feedback, Comments & Corrections

WebViewMBS.EvaluateJavaScript(code as string) as string
Type Topic Plugin Version macOS Windows Linux Console & Web iOS
method HTMLViewer Mac MBS MacControls Plugin 7.2 Yes No No Yes, macOS only No
Function: Runs the given java script and returns the result.
Example:
// shows current user agent string which the control sends to website
MsgBox webview1.EvaluateJavaScript("navigator.userAgent;")

// using eval:
MsgBox webview1.EvaluateJavaScript("eval(""x=10;y=20;x*y"")")

// with function:
MsgBox webview1.EvaluateJavaScript(" test(); function test() { x = 10 ; y = 20; return x * y;}")

// with multiline script:
dim s as string = "test();"+EndOfLine+_
"function test()"+EndOfLine+_
"{ "+EndOfLine+_
" x = 10; "+EndOfLine+_
" y = 20; "+EndOfLine+_
" return x * y;"+EndOfLine+_
"}"

MsgBox webview1.EvaluateJavaScript(s)
Notes:
Returns "" on any error.

In Safari 2 we used "return 1+2;" while in Safari 3 we only need "1+2;". The return is no longer needed. Be aware that there is an implicit return now with Safari 3!

Feedback, Comments & Corrections

WebViewMBS.GoBack
Type Topic Plugin Version macOS Windows Linux Console & Web iOS
method HTMLViewer Mac MBS MacControls Plugin 7.2 Yes No No Yes, macOS only No
Function: Go back to the previous URL in the backforward list.

Feedback, Comments & Corrections

WebViewMBS.GoForward
Type Topic Plugin Version macOS Windows Linux Console & Web iOS
method HTMLViewer Mac MBS MacControls Plugin 7.2 Yes No No Yes, macOS only No
Function: Go forward to the next URL in the backforward list.

Feedback, Comments & Corrections

WebViewMBS.goToBackForwardItem(item as WebHistoryItemMBS) as boolean
Type Topic Plugin Version macOS Windows Linux Console & Web iOS
method HTMLViewer Mac MBS MacControls Plugin 7.2 Yes No No Yes, macOS only No
Function: Moves on the history to the given item.
Notes: Returns true on success or false on failure.

Feedback, Comments & Corrections

WebViewMBS.GroupName as string
Type Topic Plugin Version macOS Windows Linux Console & Web iOS
property HTMLViewer Mac MBS MacControls Plugin 7.2 Yes No No Yes, macOS only No
Function: The group name for this WebView.
Notes:
JavaScript may access named frames within the same group.
(Read and Write computed property)

Feedback, Comments & Corrections

WebViewMBS.HTMLText as string
Type Topic Plugin Version macOS Windows Linux Console & Web iOS
method HTMLViewer Mac MBS MacControls Plugin 12.2 Yes No No Yes, macOS only No
Function: Returns HTML text for this document.
Notes: This is the text as we generate it from current DOM tree. It is not the html text we loaded from the website. To get this original html text, please use mainFrameMBS.dataSource.data instead.

Feedback, Comments & Corrections

WebViewMBS.indent
Type Topic Plugin Version macOS Windows Linux Console & Web iOS
method HTMLViewer Mac MBS MacControls Plugin 12.2 Yes No No Yes, macOS only No
Function: Implemented by WebView to indent the selection or the insertion point if there is no selection.

Feedback, Comments & Corrections

WebViewMBS.insertBacktab
Type Topic Plugin Version macOS Windows Linux Console & Web iOS
method HTMLViewer Mac MBS MacControls Plugin 12.2 Yes No No Yes, macOS only No
Function: Implemented by WebView to handle a backward tab.
Notes: A field editor might respond to this method by selecting the field before it, while a regular text object either doesn't respond to or ignores such a message.

Feedback, Comments & Corrections

Previous items Next items

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




Links
MBS Xojo Plugins