Platforms to show: All Mac Windows Linux Cross-Platform
/Win/HTMLViewer Windows/Eval Javascript Win
Required plugins for this example: MBS Win Plugin
Last modified Sun, 9th May 2020.
You find this example project in your MBS Xojo Plugin download as a Xojo project file within the examples folder: /Win/HTMLViewer Windows/Eval Javascript Win
Download this example: Eval Javascript Win.zip
Project "Eval Javascript Win.xojo_binary_project"
Class App Inherits Application
Const kEditClear = "&Delete"
Const kFileQuit = "&Quit"
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 TextArea1 Inherits TextArea
ControlInstance TextArea1 Inherits TextArea
End Control
Control TextField1 Inherits TextField
ControlInstance TextField1 Inherits TextField
End Control
Control HTMLViewer1 Inherits HTMLViewer
ControlInstance HTMLViewer1 Inherits HTMLViewer
EventHandler Sub Open()
Me.LoadURL "about:blank"
End EventHandler
End Control
Control RunButton Inherits PushButton
ControlInstance RunButton Inherits PushButton
EventHandler Sub Action()
Dim doc As IEDocumentMBS = HTMLViewer1.IEDocumentMBS
Dim s As String = doc.Evaluate(textarea1.Text)
TextField1.Text = s
Exception ex As IEExceptionMBS
MsgBox ex.message
End EventHandler
End Control
End Class
MenuBar MainMenuBar
MenuItem FileMenu = "&File"
MenuItem FileQuit = "#App.kFileQuit"
MenuItem EditMenu = "&Edit"
MenuItem EditUndo = "&Undo"
MenuItem EditSeparator1 = "-"
MenuItem EditCut = "Cu&t"
MenuItem EditCopy = "&Copy"
MenuItem EditPaste = "&Paste"
MenuItem EditClear = "#App.kEditClear"
MenuItem EditSeparator2 = "-"
MenuItem EditSelectAll = "Select &All"
End MenuBar
End Project
See also:
- /Win/HTMLViewer Windows/HTML Editor Win
- /Win/HTMLViewer Windows/HTMLViewer Get and Set Field
- /Win/HTMLViewer Windows/HTMLViewer HTML Text and Image
- /Win/HTMLViewer Windows/HTMLViewer Image
- /Win/HTMLViewer Windows/HTMLViewer Post and Headers
- /Win/HTMLViewer Windows/Reload htmlviewer
- /Win/HTMLViewer Windows/WebKit - Chromium/HTMLViewer with WebKit on Windows
- /Win/HTMLViewer Windows/WebKit - Chromium/WebPlugins
- /Win/HTMLViewer Windows/WebKit - Chromium/Windows WebKit Cookies
- /Win/HTMLViewer Windows/Zoom HMTLViewer
Download this example: Eval Javascript Win.zip
The items on this page are in the following plugins: MBS Win Plugin.
