Platforms to show: All Mac Windows Linux Cross-Platform
/Win/HTMLViewer Windows/Run JavaScript Function
Required plugins for this example: MBS Win Plugin
You find this example project in your Plugins Download as a Xojo project file within the examples folder: /Win/HTMLViewer Windows/Run JavaScript Function
This example is the version from Sun, 9th May 2020.
Project "Run JavaScript Function.xojo_binary_project"
Class App Inherits Application
Const kEditClear = "&Löschen"
Const kFileQuit = "Beenden"
Const kFileQuitShortcut = ""
EventHandler Sub Open()
// make sure we don't end up with Internet Explorer in version 7, which is default.
Dim v As Integer = IEWebBrowserMBS.GetInternetExplorerVersion
If v < 11000 Then // below version 11.0
Dim b As Boolean = IEWebBrowserMBS.SetInternetExplorerVersion(11000)
If b Then
MsgBox "Requested Internet Explorer version 11.0."
Else
MsgBox "Failed to set IE version?"
End If
End If
End EventHandler
End Class
Class MainWindow Inherits Window
Control PushButton1 Inherits PushButton
ControlInstance PushButton1 Inherits PushButton
EventHandler Sub Action()
HTMLViewer1.LoadURL "about:blank"
End EventHandler
End Control
Control PushButton2 Inherits PushButton
ControlInstance PushButton2 Inherits PushButton
EventHandler Sub Action()
Dim doc As IEDocumentMBS = HTMLViewer1.IEDocumentMBS
// using IE
// IE needs to first load about:blank for this to work
doc.LoadHTML(TextArea1.Text)
End EventHandler
End Control
Control TextArea1 Inherits TextArea
ControlInstance TextArea1 Inherits TextArea
End Control
Control HTMLViewer1 Inherits HTMLViewer
ControlInstance HTMLViewer1 Inherits HTMLViewer
EventHandler Sub Open()
Me.LoadURL "about:blank"
End EventHandler
End Control
Control CallButton Inherits PushButton
ControlInstance CallButton Inherits PushButton
EventHandler Sub Action()
Dim doc As IEDocumentMBS = HTMLViewer1.IEDocumentMBS
Dim v As Variant = doc.CallFunction("test", "Hello ", "World")
MsgBox v
Exception ex As IEExceptionMBS
MsgBox ex.message
End EventHandler
End Control
End Class
MenuBar MenuBar1
MenuItem FileMenu = "&Ablage"
MenuItem FileQuit = "#App.kFileQuit"
MenuItem EditMenu = "&Bearbeiten"
MenuItem EditUndo = "&Rückgängig"
MenuItem UntitledMenu1 = "-"
MenuItem EditCut = "&Ausschneiden"
MenuItem EditCopy = "&Kopieren"
MenuItem EditPaste = "&Einfügen"
MenuItem EditClear = "#App.kEditClear"
MenuItem UntitledMenu0 = "-"
MenuItem EditSelectAll = "&Alles auswählen"
End MenuBar
End Project
See also:
- /Win/HTMLViewer Windows/Eval Javascript Win
- /Win/HTMLViewer Windows/HTML Editor Win
- /Win/HTMLViewer Windows/HTMLViewer execCommand
- /Win/HTMLViewer Windows/HTMLViewer Extensions
- /Win/HTMLViewer Windows/HTMLViewer Image
- /Win/HTMLViewer Windows/IE Properties
- /Win/HTMLViewer Windows/Load HTML Test
- /Win/HTMLViewer Windows/More HTMLViewer Printing
- /Win/HTMLViewer Windows/textArea Test/textArea Test
- /Win/HTMLViewer Windows/Zoom HMTLViewer
The items on this page are in the following plugins: MBS Win Plugin.