The WebBrowser control can be used to create a Web browser that can communicate between a Web page and the PowerBuilder client. For more about using the WebBrowser control, see the section called “Working with WebBrowser” in Users Guide.
The WebBrowser (WebView2) is available in Build 2797 and later; and the WebBrowser (CEF) is available in Build 2779 and earlier.
Note
This control cannot be referenced in .NET Web Service or .NET Assembly components, otherwise the component will fail to be deployed.
The WebBrowser control that uses Microsoft Edge WebView2 provides the web browsing functionality through the following properties, functions and events.
WebBrowser property |
Datatype |
Description |
---|---|---|
String |
A description of the control and/or its purpose for use by accessibility tools such as readers for visually impaired users. |
|
String |
A label that briefly describes the control, such as the text in a button or the name of a menu item. |
|
AccessibleRole (enumerated) |
Describes what kind of user interface element the control is. |
|
Boolean |
Specifies whether the control has a border. Values are:
|
|
BorderStyle (enumerated) |
Specifies the style of the border of the control. Values are: StyleBox! StyleLowered! StyleRaised! StyleShadowBox! |
|
Boolean |
Specifies whether PowerBuilder moves the control to the top of the front-to-back order. Values are:
|
|
ClassDefinition |
PowerObject |
An object of type PowerObject containing information about the class definition of the control. |
Boolean |
Specifies whether users can use the right mouse button menu on the web page. When this property is changed at runtime, the Web page will need to be refreshed or navigated again for the property to take effect. |
|
String |
The URL address that the control opens by default. This property can only be set in the painter and cannot be changed at runtime. |
|
Boolean |
Specifies whether PowerBuilder puts the control automatically into Drag mode. Values are: TRUE -- When the control is clicked, the control is automatically in Drag mode. FALSE -- When the control is clicked, the control is not automatically in Drag mode. You have to manually put the control into Drag mode by using the Drag function. |
|
String |
Specifies the name of the stock icon or the file containing the icon you want to display when the user drags the control (the ICO file). The default icon is a box the size of the control. When the user drags the control, the icon displays when the control is over an area in which the control can be dropped (a valid drop area). When the control is over an area that is not a valid drop area, the No-Drop icon displays. |
|
Boolean |
Specifies whether the control is enabled (can send and receive messages). Values are:
|
|
Integer |
Specifies the height of the control, in PowerBuilder units. |
|
Boolean |
Specifies whether the new page is opened in a new popup window (similar to "Open in new tab" in the other Web browsers). When this property is changed at runtime, the Web page will need to be refreshed or navigated again for the property to take effect. |
|
Integer |
This property is currently unsupported for the WebBrowser control. The WebBrowser control cannot receive focus when the user tabs among controls within a window. |
|
String |
Specifies the tag value assigned to the control. |
|
Integer |
Specifies the transparency of the control. Value is a percentage in the range 0 (opaque) to 100 (completely transparent). |
|
Boolean |
Specifies whether the control is visible. Values are:
|
|
Integer |
Specifies the width of the control, in PowerBuilder units. |
|
Integer |
Specifies the X position (the distance from the left edge of the window) of the control, in PowerBuilder units. |
|
Integer |
Specifies the Y position (the distance from the top of the window) of the control, in PowerBuilder units. |
WebBrowser event |
Occurs |
---|---|
When an accelerator key or key combination is pressed or released while the WebBrowser control gets the focus. |
|
When a browser address changes. |
|
(Unsupported by WebBrowser) |
|
When failed to validate the server certificate. |
|
When the WebBrowser starts loading the content of a new page. |
|
Immediately before the Open event occurs in the window. |
|
Immediately after the Close event occurs in the window. |
|
When the WebBrowser control has completed parsing the DOM content during the page loading process. |
|
When the download operation state is changed. |
|
Before a download begins. |
|
When the download status or progress information is changed. |
|
(Unsupported by WebBrowser) |
|
(Unsupported by WebBrowser) |
|
(Unsupported by WebBrowser) |
|
(Unsupported by WebBrowser) |
|
When the estimated end time is changed. |
|
After the EvaluateJavascriptAsync function is executed. |
|
Just before the control receives focus (before it is selected and becomes active). |
|
When the user presses the F1 key or drags the context help button (question mark) from the title bar to a menu item or control. |
|
When the navigation history is changed. |
|
When the default download dialog state is changed. |
|
Occurs just before a control loses focus (before it becomes inactive). |
|
When the navigation is completed. |
|
When the navigation fails or is cancelled. |
|
When the overall page loading progress has changed. |
|
After a navigation has been committed and before the browser begins loading contents in the frame. |
|
When the navigation state changes. |
|
When a Windows message occurs that is not a PowerBuilder event. |
|
When the process of printing Web page as PDF is completed. |
|
(Unsupported by WebBrowser) |
|
When a resource load is redirected. |
|
When the page title changes. |
|
When a message sent by JavaScript is received. |
You can use the global functions WebBrowserSet and WebBrowserGet to configure the settings of the WebBrowser control.
WebBrowser function |
Datatype returned |
Description |
---|---|---|
Integer |
Cancels the downloading progress of files. |
|
String |
Returns the name assigned to the control. |
|
Integer |
Closes the default download dialog. |
|
Integer |
Starts or ends the dragging of the object. |
|
Integer |
Executes JavaScript asynchronously. This function triggers the EvaluateJavascriptFinished event. |
|
Integer |
Executes JavaScript synchronously. |
|
Integer |
Creates a reference to a context-specific instance of the specified service. |
|
PowerObject |
Returns a reference to the name of the parent object. |
|
String |
Gets the HTML source code for the current page's main frame. |
|
Integer |
Goes back from the current page to the last page browsed. |
|
Integer |
Jumps from the current page to the next page. |
|
Integer |
Makes the object invisible. |
|
Integer |
Places the object in a new location specified by the X and Y arguments. |
|
Integer |
Browses the specified page. |
|
Integer |
Loads a page from the specified HTML source code. |
|
Integer |
Opens the default download dialog. |
|
Integer |
Suspends the downloading progress of files. |
|
Integer |
Returns the distance of the pointer from the left edge of the control. |
|
Integer |
Returns the distance of the pointer from the top of the control. |
|
Boolean |
Adds an event to the end of the message queue for the control. |
|
Integer |
Sends the web message in the JSON format to the top-level document in WebBrowser asynchronously. |
|
Integer |
Sends the web message in a simple string to the top-level document in WebBrowser asynchronously. |
|
Integer |
Prints the control. |
|
Integer |
Prints the current web page as PDF. |
|
Integer |
Refreshes the current page. |
|
Integer |
Registers the user defined event so that it can be triggered in JavaScript. User events can be defined with only one string-type parameter and string-type return value. |
|
Integer |
Changes the size of the control. |
|
Integer |
Resumes the downloading progress of files that were suspended. |
|
Integer |
Sets focus to the control. |
|
Integer |
Specifies the position of the control in the front-to-back order of the window. |
|
Integer |
Controls automatic redrawing of the control after each change in its properties. |
|
Integer |
Makes the control visible. |
|
Integer |
Stops navigating the source. |
|
Integer |
Triggers a specified event in the control and executes the script for the event. |
|
Object |
Returns the type of the control. |
|
Integer |
Unregisters the user defined event that is registered using the RegisterEvent function. | |
Integer |
Scales the current view with the specified zoom ratio. |
The WebBrowser control that uses the Chromium Embedded Framework (CEF) provides the web browsing functionality through the following properties, functions and events.
WebBrowser property |
Datatype |
Description |
---|---|---|
String |
A description of the control and/or its purpose for use by accessibility tools such as readers for visually impaired users. |
|
String |
A label that briefly describes the control, such as the text in a button or the name of a menu item. |
|
AccessibleRole (enumerated) |
Describes what kind of user interface element the control is. |
|
Boolean |
Specifies whether the control has a border. Values are:
|
|
BorderStyle (enumerated) |
Specifies the style of the border of the control. Values are: StyleBox! StyleLowered! StyleRaised! StyleShadowBox! |
|
Boolean |
Specifies whether PowerBuilder moves the control to the top of the front-to-back order. Values are:
|
|
ClassDefinition |
PowerObject |
An object of type PowerObject containing information about the class definition of the control. |
Boolean |
Specifies whether users can use the right mouse button menu on the web page. When this property is changed at runtime, the Web page will need to be refreshed or navigated again for the property to take effect. |
|
String |
The URL address that the control opens by default. This property can only be set in the painter and cannot be changed at runtime. |
|
Boolean |
Specifies whether PowerBuilder puts the control automatically into Drag mode. Values are: TRUE -- When the control is clicked, the control is automatically in Drag mode. FALSE -- When the control is clicked, the control is not automatically in Drag mode. You have to manually put the control into Drag mode by using the Drag function. |
|
String |
Specifies the name of the stock icon or the file containing the icon you want to display when the user drags the control (the ICO file). The default icon is a box the size of the control. When the user drags the control, the icon displays when the control is over an area in which the control can be dropped (a valid drop area). When the control is over an area that is not a valid drop area, the No-Drop icon displays. |
|
Boolean |
Specifies whether the control is enabled (can send and receive messages). Values are:
|
|
Integer |
Specifies the height of the control, in PowerBuilder units. |
|
Boolean |
Specifies whether the new page is opened in a new popup window (similar to "Open in new tab" in the other Web browsers). When this property is changed at runtime, the Web page will need to be refreshed or navigated again for the property to take effect. |
|
Integer |
This property is currently unsupported for the WebBrowser control. The WebBrowser control cannot receive focus when the user tabs among controls within a window. |
|
String |
Specifies the tag value assigned to the control. |
|
Integer |
Specifies the transparency of the control. Value is a percentage in the range 0 (opaque) to 100 (completely transparent). |
|
Boolean |
Specifies whether the control is visible. Values are:
|
|
Integer |
Specifies the width of the control, in PowerBuilder units. |
|
Integer |
Specifies the X position (the distance from the left edge of the window) of the control, in PowerBuilder units. |
|
Integer |
Specifies the Y position (the distance from the top of the window) of the control, in PowerBuilder units. |
WebBrowser event |
Occurs |
---|---|
When a frame's address changes. |
|
(Unsupported by WebBrowser) |
|
When failed to validate the server certificate. |
|
Immediately before the Open event occurs in the window. |
|
Immediately after the Close event occurs in the window. |
|
Before a download begins. |
|
When the download status or progress information has been updated. |
|
(Unsupported by WebBrowser) |
|
(Unsupported by WebBrowser) |
|
(Unsupported by WebBrowser) |
|
(Unsupported by WebBrowser) |
|
After the EvaluateJavascriptAsync function is executed. |
|
Just before the control receives focus (before it is selected and becomes active). |
|
When the user presses the F1 key or drags the context help button (question mark) from the title bar to a menu item or control. |
|
(Unsupported by WebBrowser) |
|
When the navigation fails or is cancelled. |
|
When the overall page loading progress has changed. |
|
After a navigation has been committed and before the browser begins loading contents in the frame. |
|
When the navigation state changes. |
|
When a Windows message occurs that is not a PowerBuilder event. |
|
When the process of printing Web page as PDF is completed. |
|
(Unsupported by WebBrowser) |
|
When a resource load is redirected. |
|
When the page title changes. |
You can use the global functions WebBrowserSet and WebBrowserGet to configure the path, user agent and proxy settings for the WebBrowser control.
WebBrowser function |
Datatype returned |
Description |
---|---|---|
Integer |
Cancels the downloading progress of files. |
|
String |
Returns the name assigned to the control. |
|
Integer |
Starts or ends the dragging of the object. |
|
Integer |
Executes JavaScript asynchronously. This function triggers the EvaluateJavascriptFinished event. |
|
Integer |
Executes JavaScript synchronously. |
|
Integer |
Creates a reference to a context-specific instance of the specified service. |
|
PowerObject |
Returns a reference to the name of the parent object. |
|
String |
Gets the HTML source code for the current page's main frame. |
|
Integer |
Goes back from the current page to the last page browsed. |
|
Integer |
Jumps from the current page to the next page. |
|
Integer |
Makes the object invisible. |
|
Integer |
Places the object in a new location specified by the X and Y arguments. |
|
Integer |
Browses the specified page. |
|
Integer |
Suspends the downloading progress of files. |
|
Integer |
Returns the distance of the pointer from the left edge of the control. |
|
Integer |
Returns the distance of the pointer from the top of the control. |
|
Boolean |
Adds an event to the end of the message queue for the control. |
|
Integer |
Prints the control. |
|
Integer |
Prints the current web page as PDF. |
|
Integer |
Refreshes the current page. |
|
Integer |
Registers the user defined event so that it can be triggered in JavaScript. User events can be defined with only one string-type parameter and string-type return value. |
|
Integer |
Changes the size of the control. |
|
Integer |
Resumes the downloading progress of files that were suspended. |
|
Integer |
Sets focus to the control. |
|
Integer |
Specifies the position of the control in the front-to-back order of the window. |
|
Integer |
Controls automatic redrawing of the control after each change in its properties. |
|
Integer |
Makes the control visible. |
|
Integer |
Stops navigating the source. |
|
Integer |
Triggers a specified event in the control and executes the script for the event. |
|
Object |
Returns the type of the control. |
|
Integer |
Unregisters the user defined event that is registered using the RegisterEvent function. | |
Integer |
Scales the current view with the specified zoom ratio. |
Microsoft Web Browser OLE |
WebBrowser |
Visible |
Visible |
Height |
Height |
Width |
Width |
N/A |
DefaultUrl ContextMenu PopupWindow Border BringToTop Enabled BorderStyle TabOrder Tag |
LocationUrl LocationName AddressBar Application Busy Container Document FullName FullScreen HWND Left MenuBar Name Offline Parent Path ReadyState RegisterAsBrowser RegisterAsDropTarget Resizable Silent StatusBar StatusText TheaterMode ToolBar Top TopLevelContainer Type |
N/A |
Microsoft Web Browser OLE |
WebBrowser |
Constructor |
Constructor |
NavigateError |
NavigationError |
BeforeNavigate2 |
NavigationStart |
StatustextChange (returns the proxy first, and then the URL etc.) |
NavigationStateChanged (returns cangoback and cangoforward) |
TitleChange |
TitleTextChanged |
ProgressChange (returns the amount of the completed items) |
NavigationProgressIndex (returns the percentage of completion) |
DownloadComplete |
DownloadingStateChanged |
N/A |
AddressChange ResourceRedirect PdfPrintFinished DownloadingStart |
DownloadBegin BeforeScriptExecute ClientToHostWindow CommandStateChange DocumentComplete FileDownload NavigateComplete2 NewProcess NewWindow2 NewWindow3 OnFullScreen OnMenuBar OnQuit OnstatusBar OnTheaterMode OnToolBar OnVisible PrintTemplateInstantiation PrintTemplateTeardown PrivacyImpactedStateChange PropertyChange RedirectXDomainBlocked SetPhishingFilterStatus SetSecureLockIcon ThirdPartyUrlBlocked UpdatePageStatus WebWorkerFinsihed WebWorkerStarted WindowClosing WindowSetHeight WindowSetResizable WindowSetLeft WindowSetTop WindowSetWidth WindowStateChanged |
N/A |
Microsoft Web Browser OLE |
WebBrowser |
Navigate |
Navigate |
GoBack |
GoBack |
GoForward |
GoForward |
Refresh |
Refresh |
(in the right-click popup menu) |
PrintAsPDF |
ProgressChange |
(via NavigationProgressIndex event) |
N/A |
Zoom GetSource PauseDownload ResumeDownload CancelDownload StopNavigation |
AddressBar BeforeNavigate ClientToWindow CommandStateChange DownloadBegin DownloadComplete ExecWB FrameBeforeNavigate FrameNavigateComplete FrameNewWindow FullScreen GetProperty GoHome GoSearch Height Left MenuBar NavigateComplete NewWindow Offline PropertyChange PutProperty Int QueryStatusWB Quit RegisterAsBrowser RegisterAsDropTarget Resizable Silent ShowBrowserBar StatusBar StatusText StatusTextChange Stop TheaterMode TitleChange ToolBar Top Visible Width WindowActivate WindowMove WindowResize |
N/A |